From c3bfa60a7b27cb0cc44e134dcb9951ab9d41e6f6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 21 Feb 2009 15:02:32 +0000 Subject: Kill EDropdownButton. Migrate off of gnome_program_init(). svn path=/branches/kill-bonobo/; revision=37303 --- addressbook/gui/contact-editor/test-editor.c | 4 +- .../evolution-addressbook-export-list-cards.c | 4 +- .../evolution-addressbook-export-list-folders.c | 4 +- addressbook/tools/evolution-addressbook-export.c | 14 +- plugins/backup-restore/backup.c | 17 +- shell/main.c | 27 +-- smime/tests/import-cert.c | 39 ++-- widgets/misc/Makefile.am | 14 -- widgets/misc/e-dropdown-button.c | 233 --------------------- widgets/misc/e-dropdown-button.h | 70 ------- widgets/misc/test-calendar.c | 26 +-- widgets/misc/test-dateedit.c | 30 +-- widgets/misc/test-dropdown-button.c | 99 --------- widgets/misc/test-preferences-window.c | 21 +- 14 files changed, 82 insertions(+), 520 deletions(-) delete mode 100644 widgets/misc/e-dropdown-button.c delete mode 100644 widgets/misc/e-dropdown-button.h delete mode 100644 widgets/misc/test-dropdown-button.c diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c index 44703c9e57..2f55e4777c 100644 --- a/addressbook/gui/contact-editor/test-editor.c +++ b/addressbook/gui/contact-editor/test-editor.c @@ -24,8 +24,6 @@ #include #include -#include -#include #include #include "e-contact-editor.h" #include "ebook/e-card.h" @@ -97,7 +95,7 @@ int main( int argc, char *argv[] ) char *cardstr; EContactEditor *ce; - gnome_program_init("Contact Editor Test", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL); + gtk_init (&argc, &argv); glade_init (); diff --git a/addressbook/tools/evolution-addressbook-export-list-cards.c b/addressbook/tools/evolution-addressbook-export-list-cards.c index 4b98bc77ac..417214691b 100644 --- a/addressbook/tools/evolution-addressbook-export-list-cards.c +++ b/addressbook/tools/evolution-addressbook-export-list-cards.c @@ -27,10 +27,8 @@ #include #include +#include #include -#include -#include -#include #include #include diff --git a/addressbook/tools/evolution-addressbook-export-list-folders.c b/addressbook/tools/evolution-addressbook-export-list-folders.c index f9679b3378..86affe41ff 100644 --- a/addressbook/tools/evolution-addressbook-export-list-folders.c +++ b/addressbook/tools/evolution-addressbook-export-list-folders.c @@ -24,10 +24,8 @@ #include #include +#include #include -#include -#include -#include #include diff --git a/addressbook/tools/evolution-addressbook-export.c b/addressbook/tools/evolution-addressbook-export.c index 38a73b7b02..bfcaca980c 100644 --- a/addressbook/tools/evolution-addressbook-export.c +++ b/addressbook/tools/evolution-addressbook-export.c @@ -25,9 +25,6 @@ #include #include #include -#include -#include -#include #include @@ -71,8 +68,8 @@ int main (int argc, char **argv) { ActionContext actctx; - GnomeProgram *program; GOptionContext *context; + GError *error = NULL; int current_action = ACTION_NOTHING; int IsCSV = FALSE; @@ -85,10 +82,11 @@ main (int argc, char **argv) context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); - program = gnome_program_init ( - PACKAGE, VERSION, GNOME_BONOBO_MODULE, argc, argv, - GNOME_PARAM_GOPTION_CONTEXT, context, - GNOME_PARAM_NONE); + if (!g_option_context_parse (context, &argc, &argv, &error)) { + g_printerr ("%s\n", error->message); + g_error_free (error); + exit (-1); + } /* Parsing Parameter */ if (opt_remaining && g_strv_length (opt_remaining) > 0) diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c index ac0b257d17..39ed4de4a9 100644 --- a/plugins/backup-restore/backup.c +++ b/plugins/backup-restore/backup.c @@ -431,22 +431,21 @@ dlg_response (GtkWidget *dlg, gint response, gpointer data) int main (int argc, char **argv) { - GnomeProgram *program; - GOptionContext *context; char *file = NULL, *oper = NULL; gint i; + GError *error = NULL; - gtk_init (&argc, &argv); bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - context = g_option_context_new (NULL); - g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); - program = gnome_program_init (PACKAGE, VERSION, LIBGNOME_MODULE, argc, argv, - GNOME_PROGRAM_STANDARD_PROPERTIES, - GNOME_PARAM_GOPTION_CONTEXT, context, - GNOME_PARAM_NONE); + gtk_init_with_args ( + &argc, &argv, NULL, options, GETTEXT_PACKAGE, &error); + if (error != NULL) { + g_printerr ("%s\n", error->message); + g_error_free (error); + exit (1); + } if (opt_remaining) { for (i = 0; i < g_strv_length (opt_remaining); i++) { diff --git a/shell/main.c b/shell/main.c index df542568f3..6b15768e07 100644 --- a/shell/main.c +++ b/shell/main.c @@ -390,7 +390,7 @@ setup_segv_redirect (void) #define setup_segv_redirect() (void)0 #endif -static const GOptionEntry options[] = { +static GOptionEntry entries[] = { { "component", 'c', 0, G_OPTION_ARG_STRING, &requested_view, N_("Start Evolution activating the specified component"), NULL }, { "offline", '\0', 0, G_OPTION_ARG_NONE, &start_offline, @@ -642,10 +642,8 @@ main (int argc, char **argv) #ifdef DEVELOPMENT gboolean skip_warning_dialog; #endif - GnomeProgram *program; - GOptionContext *context; - const gchar *parameter_string; gchar *filename; + GError *error = NULL; /* Make ElectricFence work. */ free (malloc (10)); @@ -654,21 +652,19 @@ main (int argc, char **argv) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - parameter_string = _("- The Evolution PIM and Email Client"); - context = g_option_context_new (parameter_string); - g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); - g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); - #ifdef G_OS_WIN32 set_paths (); #endif - program = gnome_program_init ( - PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv, - GNOME_PROGRAM_STANDARD_PROPERTIES, - GNOME_PARAM_GOPTION_CONTEXT, context, - GNOME_PARAM_HUMAN_READABLE_NAME, _("Evolution"), - NULL); + gtk_init_with_args ( + &argc, &argv, + _("- The Evolution PIM and Email Client"), + entries, GETTEXT_PACKAGE, &error); + if (error != NULL) { + g_printerr ("%s\n", error->message); + g_error_free (error); + exit (1); + } #ifdef G_OS_WIN32 if (strcmp (gettext (""), "") == 0) { @@ -778,7 +774,6 @@ main (int argc, char **argv) gtk_accel_map_save (e_get_accels_filename ()); e_icon_factory_shutdown (); - g_object_unref (program); gnome_sound_shutdown (); e_cursors_shutdown (); #ifdef G_OS_WIN32 diff --git a/smime/tests/import-cert.c b/smime/tests/import-cert.c index 006cb2c313..420afe78b8 100644 --- a/smime/tests/import-cert.c +++ b/smime/tests/import-cert.c @@ -19,7 +19,6 @@ */ #include -#include #include "e-cert-db.h" #include "e-pkcs12.h" @@ -27,31 +26,31 @@ int main (int argc, char **argv) { - ECertDB *db; - EPKCS12 *pkcs12; + ECertDB *db; + EPKCS12 *pkcs12; - gnome_program_init("import-cert-test", "0.0", LIBGNOMEUI_MODULE, argc, argv, NULL); + gtk_init (&argc, &argv); - db = e_cert_db_peek (); + db = e_cert_db_peek (); - if (!e_cert_db_import_certs_from_file (db, "ca.crt", E_CERT_CA, NULL /* XXX */)) { - g_warning ("CA cert import failed"); - } + if (!e_cert_db_import_certs_from_file (db, "ca.crt", E_CERT_CA, NULL /* XXX */)) { + g_warning ("CA cert import failed"); + } - if (!e_cert_db_import_certs_from_file (db, "", E_CERT_CONTACT, NULL /* XXX */)) { - g_warning ("contact cert import failed"); - } + if (!e_cert_db_import_certs_from_file (db, "", E_CERT_CONTACT, NULL /* XXX */)) { + g_warning ("contact cert import failed"); + } - if (!e_cert_db_import_certs_from_file (db, "", E_CERT_SITE, NULL /* XXX */)) { - g_warning ("server cert import failed"); - } + if (!e_cert_db_import_certs_from_file (db, "", E_CERT_SITE, NULL /* XXX */)) { + g_warning ("server cert import failed"); + } - pkcs12 = e_pkcs12_new (); - if (!e_pkcs12_import_from_file (pkcs12, "newcert.p12", NULL /* XXX */)) { - g_warning ("PKCS12 import failed"); - } + pkcs12 = e_pkcs12_new (); + if (!e_pkcs12_import_from_file (pkcs12, "newcert.p12", NULL /* XXX */)) { + g_warning ("PKCS12 import failed"); + } - e_cert_db_shutdown (); + e_cert_db_shutdown (); - return 0; + return 0; } diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am index 589bd1083e..c422ae9972 100644 --- a/widgets/misc/Makefile.am +++ b/widgets/misc/Makefile.am @@ -51,7 +51,6 @@ widgetsinclude_HEADERS = \ e-charset-picker.h \ e-combo-cell-editable.h \ e-dateedit.h \ - e-dropdown-button.h \ e-expander.h \ e-icon-entry.h \ e-image-chooser.h \ @@ -103,7 +102,6 @@ libemiscwidgets_la_SOURCES = \ e-charset-picker.c \ e-combo-cell-editable.c \ e-dateedit.c \ - e-dropdown-button.c \ e-expander.c \ e-icon-entry.c \ e-image-chooser.c \ @@ -167,7 +165,6 @@ libemiscwidgets_la_LIBADD = $(top_builddir)/e-util/libeutil.la \ noinst_PROGRAMS = \ test-calendar \ test-dateedit \ - test-dropdown-button \ test-preferences-window # test-calendar @@ -192,17 +189,6 @@ test_dateedit_LDADD = \ $(top_builddir)/filter/libfilter.la \ $(E_WIDGETS_LIBS) -# test-dropdown-button - -test_dropdown_button_SOURCES = \ - test-dropdown-button.c - -test_dropdown_button_LDADD = \ - libemiscwidgets.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/filter/libfilter.la \ - $(E_WIDGETS_LIBS) - # test-preferences-window test_preferences_window_SOURCES = \ diff --git a/widgets/misc/e-dropdown-button.c b/widgets/misc/e-dropdown-button.c deleted file mode 100644 index aa5f84f6c8..0000000000 --- a/widgets/misc/e-dropdown-button.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see - * - * - * Authors: - * Ettore Perazzoli - * Damon Chaplin - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "e-dropdown-button.h" - -#include - -struct _EDropdownButtonPrivate { - GtkAccelGroup *accel_group; - GtkWidget *menu; -}; - -G_DEFINE_TYPE (EDropdownButton, e_dropdown_button, GTK_TYPE_TOGGLE_BUTTON) - -/* Callback to position the pop-up menu. */ - -static void -menu_position_cb (GtkMenu *menu, - int *x, - int *y, - gboolean *push_in, - void *data) -{ - EDropdownButton *dropdown_button; - EDropdownButtonPrivate *priv; - GtkRequisition menu_requisition; - int max_x, max_y; - - dropdown_button = E_DROPDOWN_BUTTON (data); - priv = dropdown_button->priv; - - /* Calculate our preferred position. */ - gdk_window_get_origin (GTK_WIDGET (dropdown_button)->window, x, y); - *y += GTK_WIDGET (dropdown_button)->allocation.height; - - /* Now make sure we are on the screen. */ - gtk_widget_size_request (GTK_WIDGET (priv->menu), &menu_requisition); - max_x = MAX (0, gdk_screen_width () - menu_requisition.width); - max_y = MAX (0, gdk_screen_height () - menu_requisition.height); - - *x = CLAMP (*x, 0, max_x); - *y = CLAMP (*y, 0, max_y); -} - -/* Callback for the "deactivate" signal on the pop-up menu. This is used so - that we unset the state of the toggle button when the pop-up menu - disappears. */ - -static int -menu_deactivate_cb (GtkMenuShell *menu_shell, - void *data) -{ - EDropdownButton *dropdown_button; - - dropdown_button = E_DROPDOWN_BUTTON (data); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dropdown_button), FALSE); - return TRUE; -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - EDropdownButton *dropdown_button; - EDropdownButtonPrivate *priv; - - dropdown_button = E_DROPDOWN_BUTTON (object); - priv = dropdown_button->priv; - - g_object_unref (priv->accel_group); - gtk_widget_destroy (priv->menu); - - g_free (priv); - - if (GTK_OBJECT_CLASS (e_dropdown_button_parent_class)->destroy) - (* GTK_OBJECT_CLASS (e_dropdown_button_parent_class)->destroy) (object); -} - - -/* GtkWidget methods. */ - -static void -impl_toggled (GtkToggleButton *toggle_button) -{ - EDropdownButton *dropdown_button; - EDropdownButtonPrivate *priv; - - if (GTK_TOGGLE_BUTTON_CLASS (e_dropdown_button_parent_class)->toggled) - GTK_TOGGLE_BUTTON_CLASS (e_dropdown_button_parent_class)->toggled (toggle_button); - - dropdown_button = E_DROPDOWN_BUTTON (toggle_button); - priv = dropdown_button->priv; - - if (toggle_button->active) { - gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL, - menu_position_cb, dropdown_button, - 1, GDK_CURRENT_TIME); - } else { - gtk_menu_popdown (GTK_MENU (priv->menu)); - } -} - - -static void -e_dropdown_button_class_init (EDropdownButtonClass *klass) -{ - GtkObjectClass *object_class; - GtkToggleButtonClass *toggle_class; - - object_class = GTK_OBJECT_CLASS (klass); - toggle_class = GTK_TOGGLE_BUTTON_CLASS (klass); - - object_class->destroy = impl_destroy; - toggle_class->toggled = impl_toggled; -} - - -static void -e_dropdown_button_init (EDropdownButton *dropdown_button) -{ - EDropdownButtonPrivate *priv; - - priv = g_new (EDropdownButtonPrivate, 1); - priv->accel_group = gtk_accel_group_new (); - priv->menu = NULL; - - dropdown_button->priv = priv; -} - - -/** - * e_dropdown_button_construct: - * @dropdown_button: A pointer to an %EDropdownButton object - * @label_text: Text to display in the button - * @menu: The menu to pop up when the button is pressed - * - * Construct the @dropdown_button with the specified @label_text and the - * associated @menu. - **/ -void -e_dropdown_button_construct (EDropdownButton *dropdown_button, - const char *label_text, - GtkMenu *menu) -{ - EDropdownButtonPrivate *priv; - GtkWidget *hbox; - GtkWidget *arrow; - GtkWidget *label; - unsigned int accel_key; - - g_return_if_fail (dropdown_button != NULL); - g_return_if_fail (E_IS_DROPDOWN_BUTTON (dropdown_button)); - g_return_if_fail (label_text != NULL); - g_return_if_fail (menu != NULL); - g_return_if_fail (GTK_IS_MENU (menu)); - - priv = dropdown_button->priv; - - hbox = gtk_hbox_new (FALSE, 2); - gtk_container_add (GTK_CONTAINER (dropdown_button), hbox); - gtk_widget_show (hbox); - - label = gtk_label_new (""); - accel_key = gtk_label_parse_uline (GTK_LABEL (label), label_text); - gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); - gtk_widget_show (label); - gtk_widget_add_accelerator (GTK_WIDGET (dropdown_button), "clicked", - priv->accel_group, accel_key, GDK_MOD1_MASK, 0); - - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); - gtk_box_pack_start (GTK_BOX (hbox), arrow, FALSE, FALSE, 2); - gtk_widget_show (arrow); - - priv->menu = GTK_WIDGET (menu); - - g_signal_connect_object (priv->menu, "deactivate", - G_CALLBACK (menu_deactivate_cb), - dropdown_button, 0); -} - -/** - * e_dropdown_button_new: - * @label_text: Text to display in the button - * @menu: The menu to pop up when the button is pressed - * - * Create a new dropdown button. When the button is clicked, the specified - * @menu will be popped up. - * - * Return value: A pointer to the newly created %EDropdownButton. - **/ -GtkWidget * -e_dropdown_button_new (const char *label_text, - GtkMenu *menu) -{ - GtkWidget *widget; - - g_return_val_if_fail (label_text != NULL, NULL); - g_return_val_if_fail (menu != NULL, NULL); - g_return_val_if_fail (GTK_IS_MENU (menu), NULL); - - widget = g_object_new (e_dropdown_button_get_type (), NULL); - - e_dropdown_button_construct (E_DROPDOWN_BUTTON (widget), label_text, menu); - return widget; -} - diff --git a/widgets/misc/e-dropdown-button.h b/widgets/misc/e-dropdown-button.h deleted file mode 100644 index b10fd9a670..0000000000 --- a/widgets/misc/e-dropdown-button.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see - * - * - * Authors: - * Ettore Perazzoli - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _E_DROPDOWN_BUTTON_H_ -#define _E_DROPDOWN_BUTTON_H_ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_DROPDOWN_BUTTON (e_dropdown_button_get_type ()) -#define E_DROPDOWN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DROPDOWN_BUTTON, EDropdownButton)) -#define E_DROPDOWN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DROPDOWN_BUTTON, EDropdownButtonClass)) -#define E_IS_DROPDOWN_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON)) -#define E_IS_DROPDOWN_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_DROPDOWN_BUTTON)) - - -typedef struct _EDropdownButton EDropdownButton; -typedef struct _EDropdownButtonPrivate EDropdownButtonPrivate; -typedef struct _EDropdownButtonClass EDropdownButtonClass; - -struct _EDropdownButton { - GtkToggleButton parent; - - EDropdownButtonPrivate *priv; -}; - -struct _EDropdownButtonClass { - GtkToggleButtonClass parent_class; -}; - - -GType e_dropdown_button_get_type (void); -void e_dropdown_button_construct (EDropdownButton *dropdown_button, - const char *label_text, - GtkMenu *menu); -GtkWidget *e_dropdown_button_new (const char *label_text, - GtkMenu *menu); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _E_DROPDOWN_BUTTON_H_ */ diff --git a/widgets/misc/test-calendar.c b/widgets/misc/test-calendar.c index 1906c70ede..f4fe6d3039 100644 --- a/widgets/misc/test-calendar.c +++ b/widgets/misc/test-calendar.c @@ -30,9 +30,6 @@ #include -#include -#include - #include "e-calendar.h" /* Drag and Drop stuff. */ @@ -61,21 +58,20 @@ delete_event_cb (GtkWidget *widget, int main (int argc, char **argv) { - GtkWidget *app; + GtkWidget *window; GtkWidget *cal; GtkWidget *vbox; ECalendarItem *calitem; - gnome_program_init ( - "test-calendar", "0.0", LIBGNOMEUI_MODULE, - argc, argv, GNOME_PARAM_NONE); + gtk_init (&argc, &argv); - app = gnome_app_new ("Test", "Test"); - gtk_window_set_default_size (GTK_WINDOW (app), 400, 400); - gtk_window_set_resizable (GTK_WINDOW (app), TRUE); - gtk_container_set_border_width (GTK_CONTAINER (app), 8); + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "ECalendar Test"); + gtk_window_set_default_size (GTK_WINDOW (window), 400, 400); + gtk_window_set_resizable (GTK_WINDOW (window), TRUE); + gtk_container_set_border_width (GTK_CONTAINER (window), 8); - g_signal_connect (app, "delete_event", + g_signal_connect (window, "delete_event", G_CALLBACK (delete_event_cb), NULL); cal = e_calendar_new (); @@ -99,8 +95,8 @@ main (int argc, char **argv) gtk_box_pack_start (GTK_BOX (vbox), cal, TRUE, TRUE, 0); gtk_widget_show (vbox); - gnome_app_set_contents (GNOME_APP (app), vbox); - gtk_widget_show (app); + gtk_container_add (GTK_CONTAINER (window), vbox); + gtk_widget_show (window); gtk_main (); @@ -122,7 +118,7 @@ on_date_range_changed (ECalendarItem *calitem) start_day, start_month + 1, start_year, end_day, end_month + 1, end_year); - /* These days should appear bold. Remember month is 0 to 11. */ + /* These days should windowear bold. Remember month is 0 to 11. */ e_calendar_item_mark_day (calitem, 2000, 7, 26, /* 26th Aug 2000. */ E_CALENDAR_ITEM_MARK_BOLD); e_calendar_item_mark_day (calitem, 2000, 8, 13, /* 13th Sep 2000. */ diff --git a/widgets/misc/test-dateedit.c b/widgets/misc/test-dateedit.c index da6a5953b1..8c340ed45b 100644 --- a/widgets/misc/test-dateedit.c +++ b/widgets/misc/test-dateedit.c @@ -29,13 +29,11 @@ #endif #include -#include -#include #include "e-dateedit.h" static void delete_event_cb (GtkWidget *widget, GdkEventAny *event, - GtkWidget *app); + GtkWidget *window); static void on_get_date_clicked (GtkWidget *button, EDateEdit *dedit); static void on_toggle_24_hour_clicked (GtkWidget *button, @@ -52,27 +50,29 @@ static void on_time_changed (EDateEdit *dedit, int main (int argc, char **argv) { - GtkWidget *app; + GtkWidget *window; EDateEdit *dedit; GtkWidget *table, *button; - gnome_program_init ("test-dateedit", "0.0", LIBGNOMEUI_MODULE, argc, argv, NULL); + gtk_init (&argc, &argv); puts ("here"); - app = gnome_app_new ("Test", "Test"); - gtk_window_set_default_size (GTK_WINDOW (app), 300, 200); - gtk_window_set_resizable (GTK_WINDOW (app), TRUE); - gtk_container_set_border_width (GTK_CONTAINER (app), 8); + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (window), "EDateEdit Test"); + gtk_window_set_default_size (GTK_WINDOW (window), 300, 200); + gtk_window_set_resizable (GTK_WINDOW (window), TRUE); + gtk_container_set_border_width (GTK_CONTAINER (window), 8); - g_signal_connect (app, "delete_event", - G_CALLBACK (delete_event_cb), app); + g_signal_connect (window, "delete_event", + G_CALLBACK (delete_event_cb), window); table = gtk_table_new (3, 3, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 4); gtk_table_set_col_spacings (GTK_TABLE (table), 4); gtk_widget_show (table); - gnome_app_set_contents (GNOME_APP (app), table); + + gtk_container_add (GTK_CONTAINER (window), table); /* EDateEdit 1. */ dedit = E_DATE_EDIT (e_date_edit_new ()); @@ -160,7 +160,7 @@ main (int argc, char **argv) g_signal_connect (button, "clicked", G_CALLBACK (on_toggle_24_hour_clicked), dedit); - gtk_widget_show (app); + gtk_widget_show (window); gtk_main (); @@ -171,9 +171,9 @@ main (int argc, char **argv) static void delete_event_cb (GtkWidget *widget, GdkEventAny *event, - GtkWidget *app) + GtkWidget *window) { - gtk_widget_destroy (app); + gtk_widget_destroy (window); gtk_main_quit (); } diff --git a/widgets/misc/test-dropdown-button.c b/widgets/misc/test-dropdown-button.c deleted file mode 100644 index f0a7ca4d0e..0000000000 --- a/widgets/misc/test-dropdown-button.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see - * - * - * Authors: - * Ettore Perazzoli - * Damon Chaplin - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include -#include -#include - -#include "e-dropdown-button.h" - - -/* (The following is shameless stolen from `testgnome.c'. */ - -static void -item_activated (GtkWidget *widget, - void *data) -{ - printf ("%s activated.\n", (char *) data); -} - -static GnomeUIInfo ui_info[] = { - { GNOME_APP_UI_ITEM, "_New", "Create a new file", item_activated, "file/new", NULL, - GNOME_APP_PIXMAP_STOCK, GTK_STOCK_NEW, 'n', GDK_CONTROL_MASK, NULL }, - { GNOME_APP_UI_ITEM, "_Open...", "Open an existing file", item_activated, "file/open", NULL, - GNOME_APP_PIXMAP_STOCK, GTK_STOCK_OPEN, 'o', GDK_CONTROL_MASK, NULL }, - { GNOME_APP_UI_ITEM, "_Save", "Save the current file", item_activated, "file/save", NULL, - GNOME_APP_PIXMAP_STOCK, GTK_STOCK_SAVE, 's', GDK_CONTROL_MASK, NULL }, - { GNOME_APP_UI_ITEM, "Save _as...", "Save the current file with a new name", item_activated, "file/save as", NULL, - GNOME_APP_PIXMAP_STOCK, GTK_STOCK_SAVE_AS, 0, 0, NULL }, - - GNOMEUIINFO_SEPARATOR, - - { GNOME_APP_UI_ITEM, "_Print...", "Print the current file", item_activated, "file/print", NULL, - GNOME_APP_PIXMAP_STOCK, GTK_STOCK_PRINT, 'p', GDK_CONTROL_MASK, NULL }, - - GNOMEUIINFO_SEPARATOR, - - { GNOME_APP_UI_ITEM, "_Close", "Close the current file", item_activated, "file/close", NULL, - GNOME_APP_PIXMAP_STOCK, GTK_STOCK_CLOSE, 0, 0, NULL }, - { GNOME_APP_UI_ITEM, "E_xit", "Exit the program", item_activated, "file/exit", NULL, - GNOME_APP_PIXMAP_STOCK, GTK_STOCK_QUIT, 'q', GDK_CONTROL_MASK, NULL }, - GNOMEUIINFO_END -}; - - -int -main (int argc, char **argv) -{ - GtkWidget *window; - GtkWidget *menu; - GtkWidget *dropdown_button; - - gnome_program_init ( - "test-dropdown-button", "0.0", LIBGNOMEUI_MODULE, - argc, argv, GNOME_PARAM_NONE); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_default_size (GTK_WINDOW (window), 1, 1); - - menu = gtk_menu_new (); - - gnome_app_fill_menu (GTK_MENU_SHELL (menu), ui_info, NULL, TRUE, 0); - - dropdown_button = e_dropdown_button_new ("Me_nu", GTK_MENU (menu)); - gtk_container_add (GTK_CONTAINER (window), dropdown_button); - - gtk_widget_show (window); - gtk_widget_show (dropdown_button); - - gtk_main (); - - return 0; -} diff --git a/widgets/misc/test-preferences-window.c b/widgets/misc/test-preferences-window.c index 8bd8aa8950..bc53f98c58 100644 --- a/widgets/misc/test-preferences-window.c +++ b/widgets/misc/test-preferences-window.c @@ -22,8 +22,6 @@ #include "e-preferences-window.c" #include -#include -#include #define NUM_PAGES 10 @@ -65,21 +63,20 @@ delete_event_callback (GtkWidget *widget, int main (int argc, char **argv) { - GtkWidget *dialog; + GtkWidget *window; - gnome_program_init ( - "test-preferences-window", "0.0", LIBGNOMEUI_MODULE, - argc, argv, GNOME_PARAM_NONE); + gtk_init (&argc, &argv); - dialog = e_preferences_window_new (); + window = e_preferences_window_new (); + gtk_window_set_default_size (GTK_WINDOW (window), 400, 300); - gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300); - g_signal_connect((dialog), "delete_event", - G_CALLBACK (delete_event_callback), NULL); + g_signal_connect( + window, "delete-event", + G_CALLBACK (delete_event_callback), NULL); - add_pages (E_PREFERENCES_WINDOW (dialog)); + add_pages (E_PREFERENCES_WINDOW (window)); - gtk_widget_show (dialog); + gtk_widget_show (window); gtk_main (); -- cgit v1.2.3