"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "install_user.c" between
jpilot-1.8.2.tar.gz and jpilot-2_0_1.tar.gz

About: J-Pilot is a desktop organizer application for Palm Pilot (PalmOS) devices. Ported to GTK3.

install_user.c  (jpilot-1.8.2):install_user.c  (jpilot-2_0_1)
skipping to change at line 74 skipping to change at line 74
} }
return NULL; return NULL;
} }
static void cb_install_user_button(GtkWidget *widget, gpointer data) static void cb_install_user_button(GtkWidget *widget, gpointer data)
{ {
GtkWidget *w; GtkWidget *w;
struct install_dialog_data *Pdata; struct install_dialog_data *Pdata;
w = gtk_widget_get_toplevel(widget); w = gtk_widget_get_toplevel(widget);
Pdata = gtk_object_get_data(GTK_OBJECT(w), "install_dialog_data"); Pdata = g_object_get_data(G_OBJECT(w), "install_dialog_data");
if (Pdata) { if (Pdata) {
Pdata->button_hit = GPOINTER_TO_INT(data); Pdata->button_hit = GPOINTER_TO_INT(data);
if (Pdata->button_hit == DIALOG_SAID_1) { if (Pdata->button_hit == DIALOG_SAID_1) {
g_strlcpy(Pdata->user, g_strlcpy(Pdata->user,
gtk_entry_get_text(GTK_ENTRY(Pdata->user_entry)), gtk_entry_get_text(GTK_ENTRY(Pdata->user_entry)),
sizeof(Pdata->user)); sizeof(Pdata->user));
sscanf(gtk_entry_get_text(GTK_ENTRY(Pdata->ID_entry)), "%lu", sscanf(gtk_entry_get_text(GTK_ENTRY(Pdata->ID_entry)), "%lu",
&(Pdata->id)); &(Pdata->id));
} }
} }
skipping to change at line 123 skipping to change at line 123
install_user_dialog = gtk_widget_new(GTK_TYPE_WINDOW, install_user_dialog = gtk_widget_new(GTK_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL, "type", GTK_WINDOW_TOPLEVEL,
"window_position", GTK_WIN_POS_MOUSE, "window_position", GTK_WIN_POS_MOUSE,
"title", _("Install User"), "title", _("Install User"),
NULL); NULL);
gtk_window_set_modal(GTK_WINDOW(install_user_dialog), TRUE); gtk_window_set_modal(GTK_WINDOW(install_user_dialog), TRUE);
if (main_window) { if (main_window) {
gtk_window_set_transient_for(GTK_WINDOW(install_user_dialog), GTK_WINDOW(m ain_window)); gtk_window_set_transient_for(GTK_WINDOW(install_user_dialog), GTK_WINDOW(m ain_window));
} }
gtk_signal_connect(GTK_OBJECT(install_user_dialog), "destroy", g_signal_connect(G_OBJECT(install_user_dialog), "destroy",
GTK_SIGNAL_FUNC(cb_destroy_dialog), install_user_dialog); G_CALLBACK(cb_destroy_dialog), install_user_dialog);
gtk_object_set_data(GTK_OBJECT(install_user_dialog), g_object_set_data(G_OBJECT(install_user_dialog),
"install_dialog_data", &data); "install_dialog_data", &data);
vbox = gtk_vbox_new(FALSE, 5); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
gtk_container_add(GTK_CONTAINER(install_user_dialog), vbox); gtk_container_add(GTK_CONTAINER(install_user_dialog), vbox);
hbox = gtk_hbox_new(FALSE, 0); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
label = gtk_label_new(_("A PalmOS(c) device needs a user name and a user ID i n order to sync properly.")); label = gtk_label_new(_("A PalmOS(c) device needs a user name and a user ID i n order to sync properly."));
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
hbox = gtk_hbox_new(FALSE, 0); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
label = gtk_label_new(_("If you want to sync more than 1 PalmOS(c) device eac h one should have a different ID and preferably a different user name.")); label = gtk_label_new(_("If you want to sync more than 1 PalmOS(c) device eac h one should have a different ID and preferably a different user name."));
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
srandom(time(NULL)); srandom(time(NULL));
/* RAND_MAX is 32768 on Solaris machines for some reason. /* RAND_MAX is 32768 on Solaris machines for some reason.
* If someone knows how to fix this, let me know. * If someone knows how to fix this, let me know.
*/ */
if (RAND_MAX==32768) { if (RAND_MAX==32768) {
id = 1+(2000000000.0*random()/(2147483647+1.0)); id = 1+(2000000000.0*random()/(2147483647+1.0));
} else { } else {
id = 1+(2000000000.0*random()/(RAND_MAX+1.0)); id = 1+(2000000000.0*random()/(RAND_MAX+1.0));
} }
g_snprintf(s_id, 30, "%ld", id); g_snprintf(s_id, 30, "%ld", id);
/* User Name entry */ /* User Name entry */
hbox = gtk_hbox_new(FALSE, 0); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
/* Instruction label */ /* Instruction label */
label = gtk_label_new(_("Most people choose their name or nickname for the us er name.")); label = gtk_label_new(_("Most people choose their name or nickname for the us er name."));
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap(GTK_LABEL(label), FALSE); gtk_label_set_line_wrap(GTK_LABEL(label), FALSE);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
/* User Name */ /* User Name */
hbox = gtk_hbox_new(FALSE, 5); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
label = gtk_label_new(_("User Name")); label = gtk_label_new(_("User Name"));
user_entry = gtk_entry_new_with_max_length(128); user_entry = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(user_entry), 128);
entry_set_multiline_truncate(GTK_ENTRY(user_entry), TRUE); entry_set_multiline_truncate(GTK_ENTRY(user_entry), TRUE);
data.user_entry = user_entry; data.user_entry = user_entry;
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 2); gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 2);
/* Instruction label */ /* Instruction label */
hbox = gtk_hbox_new(FALSE, 0); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
label = gtk_label_new(_("The ID should be a random number.")); label = gtk_label_new(_("The ID should be a random number."));
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
/* User ID */ /* User ID */
hbox = gtk_hbox_new(FALSE, 5); hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
label = gtk_label_new(_("User ID")); label = gtk_label_new(_("User ID"));
ID_entry = gtk_entry_new_with_max_length(32); ID_entry = gtk_entry_new();
gtk_entry_set_max_length(GTK_ENTRY(ID_entry), 32);
entry_set_multiline_truncate(GTK_ENTRY(ID_entry), TRUE); entry_set_multiline_truncate(GTK_ENTRY(ID_entry), TRUE);
data.ID_entry = ID_entry; data.ID_entry = ID_entry;
gtk_entry_set_text(GTK_ENTRY(ID_entry), s_id); gtk_entry_set_text(GTK_ENTRY(ID_entry), s_id);
whoami = jp_user_or_whoami(); whoami = jp_user_or_whoami();
if (whoami) { if (whoami) {
gtk_entry_set_text(GTK_ENTRY(user_entry), whoami); gtk_entry_set_text(GTK_ENTRY(user_entry), whoami);
free(whoami); free(whoami);
} }
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(hbox), ID_entry, TRUE, TRUE, 2); gtk_box_pack_start(GTK_BOX(hbox), ID_entry, TRUE, TRUE, 2);
/* Cancel/Install buttons */ /* Cancel/Install buttons */
hbox = gtk_hbutton_box_new(); hbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
gtk_button_box_set_layout(GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END); gtk_button_box_set_layout(GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 6); gtk_box_set_spacing(GTK_BOX(hbox), 6);
gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 2); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 2);
button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); button = gtk_button_new_with_label("Cancel");
gtk_signal_connect(GTK_OBJECT(button), "clicked", g_signal_connect(G_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_install_user_button), G_CALLBACK(cb_install_user_button),
GINT_TO_POINTER(DIALOG_SAID_2)); GINT_TO_POINTER(DIALOG_SAID_2));
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 1);
button = gtk_button_new_with_label(_("Install User")); button = gtk_button_new_with_label(_("Install User"));
gtk_signal_connect(GTK_OBJECT(button), "clicked", g_signal_connect(G_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(cb_install_user_button), G_CALLBACK(cb_install_user_button),
GINT_TO_POINTER(DIALOG_SAID_1)); GINT_TO_POINTER(DIALOG_SAID_1));
gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 1);
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_widget_set_can_default(button,TRUE);
gtk_widget_grab_default(button); gtk_widget_grab_default(button);
gtk_widget_grab_focus(button); gtk_widget_grab_focus(button);
gtk_widget_show_all(install_user_dialog); gtk_widget_show_all(install_user_dialog);
gtk_main(); gtk_main();
g_strlcpy(user, data.user, user_len); g_strlcpy(user, data.user, user_len);
*user_id = data.id; *user_id = data.id;
 End of changes. 17 change blocks. 
21 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)