Mercurial > gftp.yaz
changeset 21:4b244bf9d84d
2002-09-16 Brian Masney <masneyb@gftp.org>
* src/gtk/gftp-gtk.c, src/gtk/menu-items.c, src/gtk/misc-gtk.c -
Fixed compile errors when compiling against GTK+ 1.2
* src/gtk/misc-gtk.c (MakeEditDialog, MakeYesNoDialog) - fixed to work
with GTK+ 1.2
author | masneyb |
---|---|
date | Tue, 17 Sep 2002 12:00:50 +0000 |
parents | 3d8380283d0c |
children | cc6431f1ca55 |
files | ChangeLog src/gtk/gftp-gtk.c src/gtk/menu-items.c src/gtk/misc-gtk.c |
diffstat | 4 files changed, 90 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Sep 17 01:34:31 2002 +0000 +++ b/ChangeLog Tue Sep 17 12:00:50 2002 +0000 @@ -1,3 +1,10 @@ +2002-09-16 Brian Masney <masneyb@gftp.org> + * src/gtk/gftp-gtk.c, src/gtk/menu-items.c, src/gtk/misc-gtk.c - + Fixed compile errors when compiling against GTK+ 1.2 + + * src/gtk/misc-gtk.c (MakeEditDialog, MakeYesNoDialog) - fixed to work + with GTK+ 1.2 + 2002-09-15 Brian Masney <masneyb@gftp.org> * lib/gftp.h (struct gftp_transfer) - changed the type of numfiles and numdirs from unsigned long to long. This must be a signed field. This
--- a/src/gtk/gftp-gtk.c Tue Sep 17 01:34:31 2002 +0000 +++ b/src/gtk/gftp-gtk.c Tue Sep 17 12:00:50 2002 +0000 @@ -629,7 +629,7 @@ gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), num); #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 - tempwid = toolbar_pixmap (ui, "stop.xpm"); + tempwid = toolbar_pixmap (parent, "stop.xpm"); #else tempwid = gtk_image_new_from_stock (GTK_STOCK_STOP, GTK_ICON_SIZE_LARGE_TOOLBAR);
--- a/src/gtk/menu-items.c Tue Sep 17 01:34:31 2002 +0000 +++ b/src/gtk/menu-items.c Tue Sep 17 12:00:50 2002 +0000 @@ -205,7 +205,7 @@ static void -destroy_save_directory_listing (gftp_save_dir_struct * str) +destroy_save_directory_listing (GtkWidget * widget, gftp_save_dir_struct * str) { gtk_widget_destroy (str->filew); g_free (str); @@ -287,11 +287,12 @@ gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), "clicked", GTK_SIGNAL_FUNC (dosave_directory_listing), str); - gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), - "clicked", - GTK_SIGNAL_FUNC (destroy_save_directory_listing), - str); - gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button), "clicked", GTK_SIGNAL_FUNC (destroy_save_directory_listing), str); + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), + "clicked", + GTK_SIGNAL_FUNC (destroy_save_directory_listing), str); + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button), + "clicked", + GTK_SIGNAL_FUNC (destroy_save_directory_listing), str); gtk_window_set_wmclass (GTK_WINDOW(filew), "Save Directory Listing", "gFTP"); gtk_widget_show (filew);
--- a/src/gtk/misc-gtk.c Tue Sep 17 01:34:31 2002 +0000 +++ b/src/gtk/misc-gtk.c Tue Sep 17 12:00:50 2002 +0000 @@ -776,7 +776,38 @@ } -#if !(GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2) +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 +static void +ok_dialog_response (GtkWidget * widget, gftp_dialog_data * ddata) +{ + if (ddata->edit == NULL) + gtk_widget_destroy (ddata->dialog); + + if (ddata->yesfunc != NULL) + ddata->yesfunc (ddata->yespointer, ddata); + + if (ddata->edit != NULL) + gtk_widget_destroy (ddata->dialog); + + g_free (ddata); +} + + +static void +cancel_dialog_response (GtkWidget * widget, gftp_dialog_data * ddata) +{ + if (ddata->edit == NULL) + gtk_widget_destroy (ddata->dialog); + + if (ddata->nofunc != NULL) + ddata->nofunc (ddata->nopointer, ddata); + + if (ddata->edit != NULL) + gtk_widget_destroy (ddata->dialog); + + g_free (ddata); +} +#else static void dialog_response (GtkWidget * widget, gint response, gftp_dialog_data * ddata) { @@ -896,18 +927,42 @@ } #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 -/* FIXME - fix call backs */ - tempwid = gtk_button_new_with_label (oktxt); + switch (okbutton) + { + case gftp_dialog_button_create: + yes_text = _("Add"); + break; + case gftp_dialog_button_change: + yes_text = _("Change"); + break; + case gftp_dialog_button_connect: + yes_text = _("Connect"); + break; + case gftp_dialog_button_rename: + yes_text = _("Rename"); + break; + default: + yes_text = ""; + break; + } + + tempwid = gtk_button_new_with_label (yes_text); GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, TRUE, TRUE, 0); + gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", + GTK_SIGNAL_FUNC (ok_dialog_response), + ddata); gtk_widget_grab_default (tempwid); gtk_widget_show (tempwid); - tempwid = gtk_button_new_with_label (canceltxt); + tempwid = gtk_button_new_with_label (_("Cancel")); GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, TRUE, TRUE, 0); + gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", + GTK_SIGNAL_FUNC (cancel_dialog_response), + ddata); gtk_widget_show (tempwid); #else g_signal_connect (GTK_OBJECT (dialog), "response", @@ -924,10 +979,17 @@ void (*nofunc) (), gpointer nopointer) { GtkWidget * text, * dialog; -#if !(GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2) gftp_dialog_data * ddata; +#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 + GtkWidget * tempwid; #endif + ddata = g_malloc (sizeof (*ddata)); + ddata->yesfunc = yesfunc; + ddata->yespointer = yespointer; + ddata->nofunc = nofunc; + ddata->nopointer = nopointer; + #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 dialog = gtk_dialog_new (); gtk_grab_add (dialog); @@ -957,19 +1019,20 @@ gdk_window_set_icon_name (dialog->window, _("gFTP Icon")); } + ddata->dialog = dialog; + text = gtk_label_new (infotxt); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), text, TRUE, TRUE, 0); gtk_widget_show (text); #if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 2 -/* FIXME - fix call backs */ tempwid = gtk_button_new_with_label (_(" Yes ")); GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, FALSE, FALSE, 0); - gtk_signal_connect_object_before (GTK_OBJECT (tempwid), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (dialog)); + gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", + GTK_SIGNAL_FUNC (ok_dialog_response), + ddata); gtk_widget_grab_default (tempwid); gtk_widget_show (tempwid); @@ -977,18 +1040,12 @@ GTK_WIDGET_SET_FLAGS (tempwid, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid, FALSE, FALSE, 0); - gtk_signal_connect_object_before (GTK_OBJECT (tempwid), "clicked", - GTK_SIGNAL_FUNC (gtk_widget_destroy), - GTK_OBJECT (dialog)); + gtk_signal_connect (GTK_OBJECT (tempwid), "clicked", + GTK_SIGNAL_FUNC (cancel_dialog_response), + ddata); gtk_widget_show (tempwid); #else - ddata = g_malloc (sizeof (*ddata)); - ddata->yesfunc = yesfunc; - ddata->yespointer = yespointer; - ddata->nofunc = nofunc; - ddata->nopointer = nopointer; - g_signal_connect (GTK_OBJECT (dialog), "response", G_CALLBACK (dialog_response), ddata); #endif