diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-01-03 05:32:14 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-01-03 05:32:14 +0800 |
commit | 64ea8d10a87fe73f712963104909f4897b0c4f11 (patch) | |
tree | 1bd873666afef36347bc10b6f9eed57758e68549 | |
parent | 84c85d8eb70ca06ba9c608a83d1de6c814433c85 (diff) | |
download | gsoc2013-evolution-64ea8d10a87fe73f712963104909f4897b0c4f11.tar.gz gsoc2013-evolution-64ea8d10a87fe73f712963104909f4897b0c4f11.tar.zst gsoc2013-evolution-64ea8d10a87fe73f712963104909f4897b0c4f11.zip |
A bunch of fixes to make e-util build with -DG_DISABLE_DEPRECATED and
2003-01-02 Jeffrey Stedfast <fejj@ximian.com>
A bunch of fixes to make e-util build with -DG_DISABLE_DEPRECATED
and -DGTK_DISABLE_DEPRECATED.
svn path=/trunk/; revision=19210
-rw-r--r-- | e-util/ChangeLog | 5 | ||||
-rw-r--r-- | e-util/Makefile.am | 2 | ||||
-rw-r--r-- | e-util/e-categories-config.c | 25 | ||||
-rw-r--r-- | e-util/e-dialog-utils.c | 70 | ||||
-rw-r--r-- | e-util/e-dialog-widgets.c | 283 | ||||
-rw-r--r-- | e-util/e-gtk-utils.c | 19 | ||||
-rw-r--r-- | e-util/e-mktemp.c | 2 | ||||
-rw-r--r-- | e-util/e-request.c | 33 |
8 files changed, 205 insertions, 234 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 495144e4b8..f9139f7fb6 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,8 @@ +2003-01-02 Jeffrey Stedfast <fejj@ximian.com> + + A bunch of fixes to make e-util build with -DG_DISABLE_DEPRECATED + and -DGTK_DISABLE_DEPRECATED. + 2003-01-02 Ettore Perazzoli <ettore@ximian.com> * e-gtk-utils.c (e_signal_connect_full_while_alive): Get to diff --git a/e-util/Makefile.am b/e-util/Makefile.am index 986bccf5e7..dfeea653a7 100644 --- a/e-util/Makefile.am +++ b/e-util/Makefile.am @@ -11,6 +11,8 @@ INCLUDES = \ -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \ -DEVOLUTION_CATEGORY_ICONS=\""$(imagesdir)/categories"\" \ -DG_LOG_DOMAIN=\"e-utils\" \ + -DG_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED \ $(DB3_CFLAGS) \ $(PISOCK_CFLAGS) \ $(E_UTIL_CFLAGS) diff --git a/e-util/e-categories-config.c b/e-util/e-categories-config.c index 987badebf9..6d286197b6 100644 --- a/e-util/e-categories-config.c +++ b/e-util/e-categories-config.c @@ -12,7 +12,6 @@ #include <libgnomeui/gnome-dialog.h> #include <libgnome/gnome-i18n.h> #include <gdk-pixbuf/gdk-pixbuf.h> -#include <gal/widgets/e-unicode.h> #include <gal/widgets/e-categories.h> #include "e-categories-config.h" #include "e-categories-master-list-wombat.h" @@ -176,34 +175,34 @@ e_categories_config_set_icon_for (const char *category, const char *icon_file) void e_categories_config_open_dialog_for_entry (GtkEntry *entry) { - char *categories; GnomeDialog *dialog; + const char *text; + char *categories; int result; - + g_return_if_fail (entry != NULL); g_return_if_fail (GTK_IS_ENTRY (entry)); - + if (!initialized) initialize_categories_config (); - - categories = e_utf8_gtk_entry_get_text (GTK_ENTRY (entry)); - dialog = GNOME_DIALOG (e_categories_new (categories)); - + + text = gtk_entry_get_text (GTK_ENTRY (entry)); + dialog = GNOME_DIALOG (e_categories_new (text)); + gtk_object_set (GTK_OBJECT (dialog), "ecml", ecmlw, NULL); - + /* run the dialog */ result = gnome_dialog_run (dialog); - g_free (categories); - + if (result == 0) { gtk_object_get (GTK_OBJECT (dialog), "categories", &categories, NULL); - e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), categories); + gtk_entry_set_text (GTK_ENTRY (entry), categories); g_free (categories); } - + gtk_object_destroy (GTK_OBJECT (dialog)); } diff --git a/e-util/e-dialog-utils.c b/e-util/e-dialog-utils.c index 47b80c87e6..c4b36dc17a 100644 --- a/e-util/e-dialog-utils.c +++ b/e-util/e-dialog-utils.c @@ -52,9 +52,9 @@ transient_realize_callback (GtkWidget *widget) { GdkWindow *window; - window = gtk_object_get_data (GTK_OBJECT (widget), TRANSIENT_DATA_ID); + window = g_object_get_data ((GObject *) widget, TRANSIENT_DATA_ID); g_assert (window != NULL); - + gdk_window_set_transient_for (GTK_WIDGET (widget)->window, window); } @@ -63,18 +63,18 @@ transient_unrealize_callback (GtkWidget *widget) { GdkWindow *window; - window = gtk_object_get_data (GTK_OBJECT (widget), TRANSIENT_DATA_ID); + window = g_object_get_data ((GObject *) widget, TRANSIENT_DATA_ID); g_assert (window != NULL); - + gdk_property_delete (window, gdk_atom_intern ("WM_TRANSIENT_FOR", FALSE)); } static void -transient_destroy_callback (GtkWidget *widget) +transient_destroy_callback (GtkWidget *widget, GObject *deadbeef) { GdkWindow *window; - window = gtk_object_get_data (GTK_OBJECT (widget), "transient"); + window = g_object_get_data ((GObject *) widget, "transient"); if (window != NULL) gdk_window_unref (window); } @@ -84,32 +84,28 @@ set_transient_for_gdk (GtkWindow *window, GdkWindow *parent) { g_return_if_fail (window != NULL); - g_return_if_fail (gtk_object_get_data (GTK_OBJECT (window), TRANSIENT_DATA_ID) == NULL); - + g_return_if_fail (g_object_get_data ((GObject *) window, TRANSIENT_DATA_ID) == NULL); + /* if the parent window doesn't exist anymore, * something is probably about to go very wrong, * but at least let's not segfault here. */ - + if (parent == NULL) { g_warning ("set_transient_for_gdk: uhoh, parent of window %p is NULL", window); return; } - + gdk_window_ref (parent); /* FIXME? */ - - gtk_object_set_data (GTK_OBJECT (window), TRANSIENT_DATA_ID, parent); - + + g_object_set_data ((GObject *) window, TRANSIENT_DATA_ID, parent); + if (GTK_WIDGET_REALIZED (window)) gdk_window_set_transient_for (GTK_WIDGET (window)->window, parent); - - gtk_signal_connect (GTK_OBJECT (window), "realize", - GTK_SIGNAL_FUNC (transient_realize_callback), NULL); - - gtk_signal_connect (GTK_OBJECT (window), "unrealize", - GTK_SIGNAL_FUNC (transient_unrealize_callback), NULL); - gtk_signal_connect (GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (transient_destroy_callback), NULL); + g_signal_connect (window, "realize", G_CALLBACK (transient_realize_callback), NULL); + g_signal_connect (window, "unrealize", G_CALLBACK (transient_unrealize_callback), NULL); + + g_object_weak_ref ((GObject *) window, (GWeakNotify) transient_destroy_callback, window); } @@ -181,7 +177,7 @@ e_set_dialog_parent_from_xid (GtkWindow *dialog, } static void -e_gnome_dialog_parent_destroyed (GtkWidget *parent, GtkWidget *dialog) +e_gnome_dialog_parent_destroyed (GnomeDialog *dialog, GObject *deadbeef) { gnome_dialog_close (GNOME_DIALOG (dialog)); } @@ -190,9 +186,7 @@ void e_gnome_dialog_set_parent (GnomeDialog *dialog, GtkWindow *parent) { gnome_dialog_set_parent (dialog, parent); - gtk_signal_connect_while_alive (GTK_OBJECT (parent), "destroy", - e_gnome_dialog_parent_destroyed, - dialog, GTK_OBJECT (dialog)); + g_object_weak_ref ((GObject *) parent, (GWeakNotify) e_gnome_dialog_parent_destroyed, dialog); } GtkWidget * @@ -201,8 +195,7 @@ e_gnome_warning_dialog_parented (const char *warning, GtkWindow *parent) GtkWidget *dialog; dialog = gnome_warning_dialog_parented (warning, parent); - gtk_signal_connect_while_alive (GTK_OBJECT (parent), "destroy", - e_gnome_dialog_parent_destroyed, dialog, GTK_OBJECT(dialog)); + g_object_weak_ref ((GObject *) parent, (GWeakNotify) e_gnome_dialog_parent_destroyed, dialog); return dialog; } @@ -214,8 +207,7 @@ e_gnome_ok_cancel_dialog_parented (const char *message, GnomeReplyCallback callb GtkWidget *dialog; dialog = gnome_ok_cancel_dialog_parented (message, callback, data, parent); - gtk_signal_connect_while_alive (GTK_OBJECT (parent), "destroy", - e_gnome_dialog_parent_destroyed, dialog, GTK_OBJECT(dialog)); + g_object_weak_ref ((GObject *) parent, (GWeakNotify) e_gnome_dialog_parent_destroyed, dialog); return dialog; } @@ -227,21 +219,21 @@ save_ok (GtkWidget *widget, gpointer data) char **filename = data; const char *path; int btn = GNOME_YES; - + fs = gtk_widget_get_toplevel (widget); path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)); - + if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) { GtkWidget *dlg; - + dlg = gnome_question_dialog_modal (_("A file by that name already exists.\n" "Overwrite it?"), NULL, NULL); btn = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); } - + if (btn == GNOME_YES) *filename = g_strdup (path); - + gtk_main_quit (); } @@ -250,23 +242,21 @@ e_file_dialog_save (const char *title) { GtkFileSelection *fs; char *path, *filename = NULL; - + fs = GTK_FILE_SELECTION (gtk_file_selection_new (title)); path = g_strdup_printf ("%s/", g_get_home_dir ()); gtk_file_selection_set_filename (fs, path); g_free (path); - gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked", - GTK_SIGNAL_FUNC (save_ok), &filename); - gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked", - GTK_SIGNAL_FUNC (gtk_main_quit), NULL); + g_signal_connect (fs->ok_button, "clicked", G_CALLBACK (save_ok), &filename); + g_signal_connect (fs->cancel_button, "clicked", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show (GTK_WIDGET (fs)); gtk_grab_add (GTK_WIDGET (fs)); gtk_main (); gtk_widget_destroy (GTK_WIDGET (fs)); - + return filename; } diff --git a/e-util/e-dialog-widgets.c b/e-util/e-dialog-widgets.c index b3ddb1b5ea..d245917682 100644 --- a/e-util/e-dialog-widgets.c +++ b/e-util/e-dialog-widgets.c @@ -33,7 +33,6 @@ #include <gtk/gtkspinbutton.h> #include <libgnomeui/gnome-dateedit.h> #include <libgnomeui/gnome-propertybox.h> -#include <gal/widgets/e-unicode.h> #include "e-dialog-widgets.h" @@ -55,17 +54,13 @@ typedef struct { /* Destroy handler for the dialog; frees the dialog hooks */ static void -dialog_destroy_cb (GtkObject *dialog, gpointer data) +dialog_destroy_cb (DialogHooks *hooks, GObject *dialog) { - DialogHooks *hooks; - - hooks = data; - g_slist_free (hooks->whooks); hooks->whooks = NULL; - + g_free (hooks); - gtk_object_set_data (dialog, "dialog-hooks", NULL); + g_object_set_data (dialog, "dialog-hooks", NULL); } /* Ensures that the dialog has the necessary attached data to store the widget @@ -75,15 +70,14 @@ static DialogHooks * get_dialog_hooks (GtkWidget *dialog) { DialogHooks *hooks; - - hooks = gtk_object_get_data (GTK_OBJECT (dialog), "dialog-hooks"); + + hooks = g_object_get_data ((GObject *) dialog, "dialog-hooks"); if (!hooks) { hooks = g_new0 (DialogHooks, 1); - gtk_object_set_data (GTK_OBJECT (dialog), "dialog-hooks", hooks); - gtk_signal_connect (GTK_OBJECT (dialog), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), hooks); + g_object_set_data ((GObject *) dialog, "dialog-hooks", hooks); + g_object_weak_ref ((GObject *) dialog, (GWeakNotify) dialog_destroy_cb, hooks); } - + return hooks; } @@ -94,11 +88,11 @@ static int value_to_index (const int *value_map, int value) { int i; - + for (i = 0; value_map[i] != -1; i++) if (value_map[i] == value) return i; - + return -1; } @@ -109,15 +103,15 @@ static int index_to_value (const int *value_map, int index) { int i; - + /* We do this the hard way, i.e. not as a simple array reference, to * check for correctness. */ - + for (i = 0; value_map[i] != -1; i++) if (i == index) return value_map[i]; - + return -1; } @@ -126,9 +120,9 @@ static void toggled_cb (GtkToggleButton *toggle, gpointer data) { GnomePropertyBox *pbox; - + pbox = GNOME_PROPERTY_BOX (data); - + /* For radio buttons, we only notify the property box if the button is * active, because we'll get one call for each of the changed buttons in * the radio group. @@ -141,26 +135,24 @@ toggled_cb (GtkToggleButton *toggle, gpointer data) static void hook_radio (GtkWidget *dialog, GtkRadioButton *radio, gpointer value_var, gpointer info) { - GSList *group; - GSList *l; - int *value; const int *value_map; - - group = gtk_radio_button_group (radio); - + GSList *group, *l; + int *value; + + group = gtk_radio_button_get_group (radio); + /* Set the value */ - + value = (int *) value_var; value_map = (const int *) info; - + e_dialog_radio_set (GTK_WIDGET (radio), *value, value_map); - + /* Hook to changed */ - + if (GNOME_IS_PROPERTY_BOX (dialog)) for (l = group; l; l = l->next) - gtk_signal_connect (GTK_OBJECT (l->data), "toggled", - GTK_SIGNAL_FUNC (toggled_cb), dialog); + g_signal_connect (l->data, "toggled", G_CALLBACK (toggled_cb), dialog); } /* Gets the value of a radio button group */ @@ -169,10 +161,10 @@ get_radio_value (GtkRadioButton *radio, gpointer value_var, gpointer info) { int *value; const int *value_map; - + value = (int *) value_var; value_map = (const int *) info; - + *value = e_dialog_radio_get (GTK_WIDGET (radio), value_map); } @@ -181,7 +173,7 @@ static void activate_cb (GtkMenuItem *item, gpointer data) { GnomePropertyBox *pbox; - + pbox = GNOME_PROPERTY_BOX (data); gnome_property_box_changed (pbox); } @@ -190,27 +182,26 @@ activate_cb (GtkMenuItem *item, gpointer data) static void hook_option_menu (GtkWidget *dialog, GtkOptionMenu *omenu, gpointer value_var, gpointer info) { - int *value; const int *value_map; - + int *value; + /* Set the value */ - + value = (int *) value_var; value_map = (const int *) info; - + e_dialog_option_menu_set (GTK_WIDGET (omenu), *value, value_map); - + /* Hook to changed */ - + if (GNOME_IS_PROPERTY_BOX (dialog)) { GtkMenu *menu; GList *l; - + menu = GTK_MENU (gtk_option_menu_get_menu (omenu)); - + for (l = GTK_MENU_SHELL (menu)->children; l; l = l->next) - gtk_signal_connect (GTK_OBJECT (l->data), "activate", - GTK_SIGNAL_FUNC (activate_cb), dialog); + g_signal_connect (l->data, "activate", G_CALLBACK (activate_cb), dialog); } } @@ -218,12 +209,12 @@ hook_option_menu (GtkWidget *dialog, GtkOptionMenu *omenu, gpointer value_var, g static void get_option_menu_value (GtkOptionMenu *omenu, gpointer value_var, gpointer info) { - int *value; const int *value_map; - + int *value; + value = (int *) value_var; value_map = (const int *) info; - + *value = e_dialog_option_menu_get (GTK_WIDGET (omenu), value_map); } @@ -232,17 +223,16 @@ static void hook_toggle (GtkWidget *dialog, GtkToggleButton *toggle, gpointer value_var, gpointer info) { gboolean *value; - + /* Set the value */ - + value = (gboolean *) value_var; e_dialog_toggle_set (GTK_WIDGET (toggle), *value); - + /* Hook to changed */ - + if (GNOME_IS_PROPERTY_BOX (dialog)) - gtk_signal_connect (GTK_OBJECT (toggle), "toggled", - GTK_SIGNAL_FUNC (toggled_cb), dialog); + g_signal_connect (toggle, "toggled", G_CALLBACK (toggled_cb), dialog); } /* Gets the value of a toggle button */ @@ -250,7 +240,7 @@ static void get_toggle_value (GtkToggleButton *toggle, gpointer value_var, gpointer info) { gboolean *value; - + value = (gboolean *) value_var; *value = e_dialog_toggle_get (GTK_WIDGET (toggle)); } @@ -260,7 +250,7 @@ static void value_changed_cb (GtkAdjustment *adj, gpointer data) { GnomePropertyBox *pbox; - + pbox = GNOME_PROPERTY_BOX (data); gnome_property_box_changed (pbox); } @@ -271,19 +261,18 @@ hook_spin_button (GtkWidget *dialog, GtkSpinButton *spin, gpointer value_var, gp { double *value; GtkAdjustment *adj; - + /* Set the value */ - + value = (double *) value_var; e_dialog_spin_set (GTK_WIDGET (spin), *value); - + /* Hook to changed */ - + adj = gtk_spin_button_get_adjustment (spin); - + if (GNOME_IS_PROPERTY_BOX (dialog)) - gtk_signal_connect (GTK_OBJECT (adj), "value_changed", - GTK_SIGNAL_FUNC (value_changed_cb), dialog); + g_signal_connect (adj, "value_changed", G_CALLBACK (value_changed_cb), dialog); } /* Gets the value of a spin button */ @@ -291,7 +280,7 @@ static void get_spin_button_value (GtkSpinButton *spin, gpointer value_var, gpointer info) { double *value; - + value = (double *) value_var; *value = e_dialog_spin_get_double (GTK_WIDGET (spin)); } @@ -301,7 +290,7 @@ static void changed_cb (GtkEditable *editable, gpointer data) { GnomePropertyBox *pbox; - + pbox = GNOME_PROPERTY_BOX (data); gnome_property_box_changed (pbox); } @@ -311,18 +300,17 @@ static void hook_editable (GtkWidget *dialog, GtkEditable *editable, gpointer value_var, gpointer info) { char **value; - + /* Set the value */ - + value = (char **) value_var; - + e_dialog_editable_set (GTK_WIDGET (editable), *value); - + /* Hook to changed */ - + if (GNOME_IS_PROPERTY_BOX (dialog)) - gtk_signal_connect (GTK_OBJECT (editable), "changed", - GTK_SIGNAL_FUNC (changed_cb), dialog); + g_signal_connect (editable, "changed", G_CALLBACK (changed_cb), dialog); } /* Gets the value of a GtkEditable widget */ @@ -330,11 +318,11 @@ static void get_editable_value (GtkEditable *editable, gpointer value_var, gpointer data) { char **value; - + value = (char **) value_var; if (*value) g_free (*value); - + *value = e_dialog_editable_get (GTK_WIDGET (editable)); } @@ -348,17 +336,15 @@ get_editable_value (GtkEditable *editable, gpointer value_var, gpointer data) void e_dialog_editable_set (GtkWidget *widget, const char *value) { + int pos = 0; + g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_EDITABLE (widget)); - + gtk_editable_delete_text (GTK_EDITABLE (widget), 0, -1); - - if (value) { - gint pos; - - pos = 0; - e_utf8_gtk_editable_insert_text (GTK_EDITABLE (widget), value, strlen (value), &pos); - } + + if (value) + gtk_editable_insert_text (GTK_EDITABLE (widget), value, strlen (value), &pos); } /** @@ -376,8 +362,8 @@ e_dialog_editable_get (GtkWidget *widget) { g_return_val_if_fail (widget != NULL, NULL); g_return_val_if_fail (GTK_IS_EDITABLE (widget), NULL); - - return e_utf8_gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1); + + return gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1); } /** @@ -397,32 +383,29 @@ e_dialog_editable_get (GtkWidget *widget) void e_dialog_radio_set (GtkWidget *widget, int value, const int *value_map) { - GSList *group; + GSList *group, *l; int i; - GSList *l; - + g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_RADIO_BUTTON (widget)); g_return_if_fail (value_map != NULL); - - group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget)); - + + group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); + i = value_to_index (value_map, value); if (i != -1) { /* Groups are built by prepending items, so the list ends up in reverse * order; we need to flip the index around. */ i = g_slist_length (group) - i - 1; - + l = g_slist_nth (group, i); if (!l) - g_message ("e_dialog_radio_set(): could not find index %d in radio group!", - i); - + g_message ("e_dialog_radio_set(): could not find index %d in radio group!", i); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (l->data), TRUE); } else - g_message ("e_dialog_radio_set(): could not find value %d in value map!", - value); + g_message ("e_dialog_radio_set(): could not find value %d in value map!", value); } /** @@ -440,38 +423,35 @@ e_dialog_radio_set (GtkWidget *widget, int value, const int *value_map) int e_dialog_radio_get (GtkWidget *widget, const int *value_map) { - GSList *group; - GSList *l; - int i; - int v; - + GSList *group, *l; + int i, v; + g_return_val_if_fail (widget != NULL, -1); g_return_val_if_fail (GTK_IS_RADIO_BUTTON (widget), -1); g_return_val_if_fail (value_map != NULL, -1); - - group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget)); - + + group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); + for (i = 0, l = group; l; l = l->next, i++) { widget = GTK_WIDGET (l->data); - + if (GTK_TOGGLE_BUTTON (widget)->active) break; } - - if (!l) - g_assert_not_reached (); - + + g_assert (l != NULL); + /* Groups are built by prepending items, so the list ends up in reverse * order; we need to flip the index around. */ i = g_slist_length (group) - i - 1; - + v = index_to_value (value_map, i); if (v == -1) { g_message ("e_dialog_radio_get(): could not find index %d in value map!", i); return -1; } - + return v; } @@ -489,7 +469,7 @@ e_dialog_toggle_set (GtkWidget *widget, gboolean value) { g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget)); - + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value); } @@ -508,7 +488,7 @@ e_dialog_toggle_get (GtkWidget *widget) { g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (widget), FALSE); - + return GTK_TOGGLE_BUTTON (widget)->active; } @@ -523,14 +503,14 @@ void e_dialog_spin_set (GtkWidget *widget, double value) { GtkAdjustment *adj; - + g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_SPIN_BUTTON (widget)); - + adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); - + adj->value = value; - gtk_signal_emit_by_name (GTK_OBJECT (adj), "value_changed"); + g_signal_emit_by_name (adj, "value_changed", 0); } /** @@ -545,10 +525,10 @@ double e_dialog_spin_get_double (GtkWidget *widget) { GtkAdjustment *adj; - + g_return_val_if_fail (widget != NULL, 0.0); g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), 0.0); - + adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget)); return adj->value; } @@ -565,10 +545,10 @@ int e_dialog_spin_get_int (GtkWidget *widget) { double value; - + g_return_val_if_fail (widget != NULL, -1); g_return_val_if_fail (GTK_IS_SPIN_BUTTON (widget), -1); - + value = e_dialog_spin_get_double (widget); return (int) floor (value); } @@ -587,13 +567,13 @@ void e_dialog_option_menu_set (GtkWidget *widget, int value, const int *value_map) { int i; - + g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_OPTION_MENU (widget)); g_return_if_fail (value_map != NULL); - + i = value_to_index (value_map, value); - + if (i != -1) gtk_option_menu_set_history (GTK_OPTION_MENU (widget), i); else @@ -622,32 +602,31 @@ e_dialog_option_menu_get (GtkWidget *widget, const int *value_map) GList *l; int i; int v; - + g_return_val_if_fail (widget != NULL, -1); g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), -1); g_return_val_if_fail (value_map != NULL, -1); - + menu = GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (widget))); - + active = gtk_menu_get_active (menu); g_assert (active != NULL); - + children = GTK_MENU_SHELL (menu)->children; - + for (i = 0, l = children; l; l = l->next, i++) { if (GTK_WIDGET (l->data) == active) break; } - - if (!l) - g_assert_not_reached (); - + + g_assert (l != NULL); + v = index_to_value (value_map, i); if (v == -1) { g_message ("e_dialog_option_menu_get(): could not find index %d in value map!", i); return -1; } - + return v; } @@ -663,7 +642,7 @@ e_dialog_dateedit_set (GtkWidget *widget, time_t t) { g_return_if_fail (widget != NULL); g_return_if_fail (GNOME_IS_DATE_EDIT (widget)); - + gnome_date_edit_set_time (GNOME_DATE_EDIT (widget), t); } @@ -680,7 +659,7 @@ e_dialog_dateedit_get (GtkWidget *widget) { g_return_val_if_fail (widget != NULL, -1); g_return_val_if_fail (GNOME_IS_DATE_EDIT (widget), -1); - + return gnome_date_edit_get_date (GNOME_DATE_EDIT (widget)); } @@ -719,18 +698,18 @@ e_dialog_widget_hook_value (GtkWidget *dialog, GtkWidget *widget, { DialogHooks *hooks; WidgetHook *wh; - + g_return_val_if_fail (dialog != NULL, FALSE); g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); g_return_val_if_fail (value_var != NULL, FALSE); - + hooks = get_dialog_hooks (dialog); - + /* First check if it is a "group" widget, like a radio button or an * option menu. Then we check for normal ungrouped widgets. */ - + if (GTK_IS_RADIO_BUTTON (widget)) hook_radio (dialog, GTK_RADIO_BUTTON (widget), value_var, info); else if (GTK_IS_OPTION_MENU (widget)) @@ -743,14 +722,14 @@ e_dialog_widget_hook_value (GtkWidget *dialog, GtkWidget *widget, hook_editable (dialog, GTK_EDITABLE (widget), value_var, info); else return FALSE; - + wh = g_new (WidgetHook, 1); wh->widget = widget; wh->value_var = value_var; wh->info = info; - + hooks->whooks = g_slist_prepend (hooks->whooks, wh); - + return TRUE; } @@ -769,16 +748,16 @@ e_dialog_get_values (GtkWidget *dialog) { DialogHooks *hooks; GSList *l; - + g_return_if_fail (dialog != NULL); - + hooks = get_dialog_hooks (dialog); - + for (l = hooks->whooks; l; l = l->next) { WidgetHook *wh; - + wh = l->data; - + if (GTK_IS_RADIO_BUTTON (wh->widget)) get_radio_value (GTK_RADIO_BUTTON (wh->widget), wh->value_var, wh->info); else if (GTK_IS_OPTION_MENU (wh->widget)) @@ -814,19 +793,19 @@ e_dialog_xml_widget_hook_value (GladeXML *xml, GtkWidget *dialog, const char *wi gpointer value_var, gpointer info) { GtkWidget *widget; - + g_return_val_if_fail (xml != NULL, FALSE); g_return_val_if_fail (GLADE_IS_XML (xml), FALSE); g_return_val_if_fail (dialog != NULL, FALSE); g_return_val_if_fail (widget_name != NULL, FALSE); g_return_val_if_fail (value_var != NULL, FALSE); - + widget = glade_xml_get_widget (xml, widget_name); if (!widget) { g_message ("e_dialog_xml_widget_hook_value(): could not find widget `%s' in " "Glade data!", widget_name); return FALSE; } - + return e_dialog_widget_hook_value (dialog, widget, value_var, info); } diff --git a/e-util/e-gtk-utils.c b/e-util/e-gtk-utils.c index 1f5aefe3ca..9b9c7f99b7 100644 --- a/e-util/e-gtk-utils.c +++ b/e-util/e-gtk-utils.c @@ -71,10 +71,10 @@ alive_disconnecter (GtkObject *object, DisconnectInfo *info) { g_assert (info != NULL); - - gtk_signal_disconnect (info->object1, info->disconnect_handler1); - gtk_signal_disconnect (info->object1, info->signal_handler); - gtk_signal_disconnect (info->object2, info->disconnect_handler2); + + g_signal_handler_disconnect (info->object1, info->disconnect_handler1); + g_signal_handler_disconnect (info->object1, info->signal_handler); + g_signal_handler_disconnect (info->object2, info->disconnect_handler2); g_free (info); @@ -122,12 +122,12 @@ e_signal_connect_full_while_alive (void *instance, instance_signal, after); info->object1 = instance; - info->disconnect_handler1 = gtk_signal_connect (instance, "destroy", - GTK_SIGNAL_FUNC (alive_disconnecter), info); + info->disconnect_handler1 = g_signal_connect (instance, "destroy", + G_CALLBACK (alive_disconnecter), info); info->object2 = alive_instance; - info->disconnect_handler2 = gtk_signal_connect (alive_instance, "destroy", - GTK_SIGNAL_FUNC (alive_disconnecter), info); + info->disconnect_handler2 = g_signal_connect (alive_instance, "destroy", + G_CALLBACK (alive_disconnecter), info); } @@ -165,6 +165,5 @@ widget_realize_callback_for_backing_store (GtkWidget *widget, void e_make_widget_backing_stored (GtkWidget *widget) { - gtk_signal_connect (GTK_OBJECT (widget), "realize", - GTK_SIGNAL_FUNC (widget_realize_callback_for_backing_store), NULL); + g_signal_connect (widget, "realize", G_CALLBACK (widget_realize_callback_for_backing_store), NULL); } diff --git a/e-util/e-mktemp.c b/e-util/e-mktemp.c index 48a45c0288..baeb9d2577 100644 --- a/e-util/e-mktemp.c +++ b/e-util/e-mktemp.c @@ -65,7 +65,7 @@ get_path (gboolean make) GString *path; path = g_string_new ("/tmp/evolution-"); - g_string_sprintfa (path, "%d-%d", (int) getuid (), (int) getpid ()); + g_string_append_printf (path, "%d-%d", (int) getuid (), (int) getpid ()); if (make) { int ret; diff --git a/e-util/e-request.c b/e-util/e-request.c index 71fcacc3ea..5cb85907f3 100644 --- a/e-util/e-request.c +++ b/e-util/e-request.c @@ -27,7 +27,6 @@ #include "e-request.h" #include <libgnomeui/gnome-dialog.h> -#include <gal/widgets/e-unicode.h> #include <gtk/gtklabel.h> #include <gtk/gtkentry.h> @@ -52,53 +51,51 @@ e_request_string (GtkWindow *parent, const char *prompt, const char *default_string) { - GtkWidget *dialog; GtkWidget *prompt_label; + const char *text = NULL; + GtkWidget *dialog; GtkWidget *entry; GtkWidget *vbox; - char *retval; - + g_return_val_if_fail (title != NULL, NULL); g_return_val_if_fail (prompt != NULL, NULL); - + dialog = gnome_dialog_new (title, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); gnome_dialog_set_parent (GNOME_DIALOG (dialog), parent); gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE); - + vbox = GNOME_DIALOG (dialog)->vbox; - + prompt_label = gtk_label_new (prompt); gtk_box_pack_start (GTK_BOX (vbox), prompt_label, TRUE, TRUE, 0); - + entry = gtk_entry_new (); - e_utf8_gtk_entry_set_text (GTK_ENTRY (entry), default_string); + gtk_entry_set_text (GTK_ENTRY (entry), default_string); gtk_entry_select_region (GTK_ENTRY (entry), 0, -1); gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0); - + gtk_widget_grab_focus (entry); gnome_dialog_editable_enters (GNOME_DIALOG (dialog), GTK_EDITABLE (entry)); - + gtk_widget_show (prompt_label); gtk_widget_show (entry); gtk_widget_show (dialog); - + switch (gnome_dialog_run (GNOME_DIALOG (dialog))) { case 0: /* OK. */ - retval = e_utf8_gtk_entry_get_text (GTK_ENTRY (entry)); + text = gtk_entry_get_text (GTK_ENTRY (entry)); break; case -1: case 1: /* Cancel. */ - retval = NULL; break; default: g_assert_not_reached (); - retval = NULL; } - + gtk_widget_destroy (dialog); - - return retval; + + return text ? g_strdup (text) : NULL; } |