#ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include "callbacks.h" #include "interface.h" #include "support.h" extern char iusername[1024], iserver[1024], icontext[1024], imountpoint[1024]; char ipassword[1024]; void on_main_window_destroy (GtkObject *object, gpointer user_data) { exit (0); } gboolean on_entry_username_focus_out_event (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { bzero( iusername, 1024 ); strcpy( iusername, (char *)gtk_entry_get_text( (GtkEntry*)widget ) ); return FALSE; } gboolean on_entry_password_focus_out_event (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { bzero (ipassword, 1024); strcpy (ipassword, (char *) gtk_entry_get_text ((GtkEntry*)widget)); return FALSE; } gboolean on_entry_context_focus_out_event (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { bzero (icontext, 1024); strcpy (icontext, (char *) gtk_entry_get_text ((GtkEntry*)widget)); return FALSE; } gboolean on_entry_mountpoint_focus_out_event (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { bzero (imountpoint, 1024); strcpy (imountpoint, (char *) gtk_entry_get_text ((GtkEntry*)widget)); return FALSE; } gboolean on_combo_entry_server_focus_out_event (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { bzero (iserver, 1024); strcpy (iserver, (char *) gtk_entry_get_text((GtkEntry*)widget)); return FALSE; } void on_login_button_clicked (GtkButton *button, gpointer user_data) { GtkWidget *dialog_warning; gchar command[1024], *buffout, *bufferr; gint exitstatus; GError *error; bzero (command, 1024); strcpy (command, "ncpmount "); if (strlen(iserver) > 0) sprintf(command + strlen(command), "-S %s ", iserver); if (strlen(iusername) > 0) sprintf(command + strlen(command), "-U %s", iusername); if (strlen(icontext) > 0) sprintf(command + strlen(command), ".%s ", icontext); else *(command + strlen(command)) = ' '; if (strlen(ipassword) > 0) sprintf(command + strlen(command), "-P %s ", ipassword); else strcpy(command + strlen(command), "-n "); if (strlen(imountpoint) > 0) strcpy(command + strlen(command), imountpoint); g_spawn_command_line_sync(command,&buffout,&bufferr,&exitstatus,&error); if (exitstatus) { strcpy (command, _("Ncpmount reports following error:\n\n")); if (strlen(bufferr) > 0) { strcpy(command + strlen(command), bufferr); strcpy (command + strlen(command), "\n"); } if (strlen(buffout) > 0) strcpy(command + strlen(command), buffout); dialog_warning = create_quick_dialog(_("Warning!"), command); gtk_widget_show(dialog_warning); } else { write_config(); exit(0); } } void on_cancel_button_clicked (GtkButton *button, gpointer user_data) { exit(0); } void on_about_button_clicked (GtkButton *button, gpointer user_data) { /* Temporatly removed by KOSHA - errors mothefucker GtkWidget *dialog_about; dialog_about = create_quick_dialog(_("About gtknw2"), _("gtk+2 Netware Client 0.2\n\n" "written by\n" "Chris Ross \n" "Grigory Batalov \n" "http://www.lrn.ru/~bga/gtknw2/\n\n" "Distributed under the GPL") ); gtk_widget_show(dialog_about); */ }