diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-04-08 05:07:26 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-04-08 05:07:26 +0800 |
commit | df95d7a64d1201e7ad0f3838aa69869be6ee8391 (patch) | |
tree | b92a5c168b09b18d7dd562158ac9f603115bfc38 /widgets/misc | |
parent | 02073ac96c3de4a24aea8c1c26b6dc983ef9c17c (diff) | |
download | gsoc2013-evolution-df95d7a64d1201e7ad0f3838aa69869be6ee8391.tar.gz gsoc2013-evolution-df95d7a64d1201e7ad0f3838aa69869be6ee8391.tar.zst gsoc2013-evolution-df95d7a64d1201e7ad0f3838aa69869be6ee8391.zip |
Updated for changes to e-config-page.c (init): Removed the OK and Apply
2004-04-07 Jeffrey Stedfast <fejj@ximian.com>
* e-multi-config-dialog.c: Updated for changes to e-config-page.c
(init): Removed the OK and Apply buttons.
* e-config-page.c (e_config_page_apply): Removed.
(e_config_page_is_applied): Removed.
(e_config_page_changed): Removed.
svn path=/trunk/; revision=25363
Diffstat (limited to 'widgets/misc')
-rw-r--r-- | widgets/misc/ChangeLog | 9 | ||||
-rw-r--r-- | widgets/misc/e-config-page.c | 101 | ||||
-rw-r--r-- | widgets/misc/e-config-page.h | 11 | ||||
-rw-r--r-- | widgets/misc/e-multi-config-dialog.c | 107 |
4 files changed, 24 insertions, 204 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 953948b637..dc9baff90d 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,12 @@ +2004-04-07 Jeffrey Stedfast <fejj@ximian.com> + + * e-multi-config-dialog.c: Updated for changes to e-config-page.c + (init): Removed the OK and Apply buttons. + + * e-config-page.c (e_config_page_apply): Removed. + (e_config_page_is_applied): Removed. + (e_config_page_changed): Removed. + 2004-04-01 Dan Winship <danw@ximian.com> * e-url-entry.c (init): Make the button initially insensitive. diff --git a/widgets/misc/e-config-page.c b/widgets/misc/e-config-page.c index ad440ca938..3140850185 100644 --- a/widgets/misc/e-config-page.c +++ b/widgets/misc/e-config-page.c @@ -29,124 +29,31 @@ #include <gal/util/e-util.h> - -enum { - APPLY, - CHANGED, - LAST_SIGNAL -}; - #define PARENT_TYPE gtk_event_box_get_type () static GtkEventBoxClass *parent_class = NULL; -static unsigned int signals[LAST_SIGNAL] = { 0 }; - -struct _EConfigPagePrivate { - gboolean changed; -}; - /* GObject methods. */ static void -impl_finalize (GObject *object) -{ - EConfigPage *page; - EConfigPagePrivate *priv; - - page = E_CONFIG_PAGE (object); - priv = page->priv; - - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -static void class_init (EConfigPageClass *class) { GObjectClass *object_class; object_class = G_OBJECT_CLASS (class); - object_class->finalize = impl_finalize; - + parent_class = g_type_class_ref(PARENT_TYPE); - - signals[APPLY] = gtk_signal_new ("apply", - GTK_RUN_LAST, - GTK_CLASS_TYPE (object_class), - G_STRUCT_OFFSET (EConfigPageClass, apply), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - signals[CHANGED] = gtk_signal_new ("changed", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - G_STRUCT_OFFSET (EConfigPageClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); } static void -init (EConfigPage *config_page) +init (EConfigPage *page, EConfigPageClass *klass) { - EConfigPagePrivate *priv; - - priv = g_new (EConfigPagePrivate, 1); - priv->changed = FALSE; - - config_page->priv = priv; + ; } - GtkWidget * e_config_page_new (void) { - GtkWidget *new; - - new = gtk_type_new (e_config_page_get_type ()); - - return new; -} - - -void -e_config_page_apply (EConfigPage *config_page) -{ - EConfigPagePrivate *priv; - - g_return_if_fail (E_IS_CONFIG_PAGE (config_page)); - - priv = config_page->priv; - - gtk_signal_emit (GTK_OBJECT (config_page), signals[APPLY]); - - priv->changed = FALSE; -} - -gboolean -e_config_page_is_applied (EConfigPage *config_page) -{ - g_return_val_if_fail (E_IS_CONFIG_PAGE (config_page), FALSE); - - return ! config_page->priv->changed; -} - -void -e_config_page_changed (EConfigPage *config_page) -{ - EConfigPagePrivate *priv; - - g_return_if_fail (E_IS_CONFIG_PAGE (config_page)); - - priv = config_page->priv; - - if (priv->changed) - return; - - priv->changed = TRUE; - gtk_signal_emit (GTK_OBJECT (config_page), signals[CHANGED]); + return gtk_type_new (e_config_page_get_type ()); } - E_MAKE_TYPE (e_config_page, "EConfigPage", EConfigPage, class_init, init, PARENT_TYPE) diff --git a/widgets/misc/e-config-page.h b/widgets/misc/e-config-page.h index 4862f8b1b5..f4efcf5671 100644 --- a/widgets/misc/e-config-page.h +++ b/widgets/misc/e-config-page.h @@ -53,22 +53,13 @@ struct _EConfigPage { struct _EConfigPageClass { GtkEventBoxClass parent_class; - - /* Signals. */ - void (* apply) (EConfigPage *config_page); - void (* changed) (EConfigPage *config_page); + }; GtkType e_config_page_get_type (void); GtkWidget *e_config_page_new (void); -void e_config_page_apply (EConfigPage *config_page); -gboolean e_config_page_is_applied (EConfigPage *config_page); - -/* Protected. */ -void e_config_page_changed (EConfigPage *config_page); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/widgets/misc/e-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c index dbd8cc4a15..85eb82b0f4 100644 --- a/widgets/misc/e-multi-config-dialog.c +++ b/widgets/misc/e-multi-config-dialog.c @@ -36,24 +36,21 @@ #include <gdk-pixbuf/gdk-pixbuf.h> - + #define PARENT_TYPE gtk_dialog_get_type () static GtkDialogClass *parent_class = NULL; #define SWITCH_PAGE_INTERVAL 250 - struct _EMultiConfigDialogPrivate { GSList *pages; - + GtkWidget *list_e_table; ETableModel *list_e_table_model; - + GtkWidget *notebook; - - int num_unapplied; - + int set_page_timeout_id; int set_page_timeout_page; }; @@ -82,26 +79,6 @@ static char *list_e_table_spec = " </ETableState>" "</ETableSpecification>"; - -/* Button handling. */ - -static void -update_buttons (EMultiConfigDialog *dialog) -{ - EMultiConfigDialogPrivate *priv; - - priv = dialog->priv; - - if (priv->num_unapplied > 0) { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, TRUE); - } else { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, FALSE); - } -} - - /* Page handling. */ static GtkWidget * @@ -132,23 +109,6 @@ create_page_container (const char *description, return vbox; } -/* Page callbacks. */ - -static void -page_changed_callback (EConfigPage *page, - void *data) -{ - EMultiConfigDialog *dialog; - EMultiConfigDialogPrivate *priv; - - dialog = E_MULTI_CONFIG_DIALOG (data); - priv = dialog->priv; - - priv->num_unapplied ++; - - update_buttons (dialog); -} - /* Timeout for switching pages (so it's more comfortable navigating with the keyboard). */ @@ -168,7 +128,6 @@ set_page_timeout_callback (void *data) } - /* Button handling. */ static void @@ -177,37 +136,7 @@ do_close (EMultiConfigDialog *dialog) gtk_widget_destroy (GTK_WIDGET (dialog)); } -static void -do_apply (EMultiConfigDialog *dialog) -{ - EMultiConfigDialogPrivate *priv; - GSList *p; - priv = dialog->priv; - - for (p = priv->pages; p != NULL; p = p->next) { - EConfigPage *page_widget = p->data; - - if (! e_config_page_is_applied (page_widget)) { - e_config_page_apply (page_widget); - priv->num_unapplied --; - } - } - - g_assert (priv->num_unapplied == 0); - update_buttons (dialog); -} - -static void -do_ok (EMultiConfigDialog *dialog) -{ - do_apply (dialog); - do_close (dialog); -} - - - - /* ETable signals. */ static void @@ -229,7 +158,7 @@ table_cursor_change_callback (ETable *etable, priv->set_page_timeout_page = row; } - + /* GObject methods. */ static void @@ -251,12 +180,11 @@ impl_finalize (GObject *object) (* G_OBJECT_CLASS (parent_class)->finalize) (object); } - + /* GtkDialog methods. */ static void -impl_response (GtkDialog *dialog, - int response_id) +impl_response (GtkDialog *dialog, int response_id) { EMultiConfigDialog *multi_config_dialog; EMultiConfigDialogPrivate *priv; @@ -277,12 +205,6 @@ impl_response (GtkDialog *dialog, if (error != NULL) g_warning ("%s", error->message); break; - case GTK_RESPONSE_OK: - do_ok (multi_config_dialog); - break; - case GTK_RESPONSE_APPLY: - do_apply (multi_config_dialog); - break; case GTK_RESPONSE_CLOSE: default: do_close (multi_config_dialog); @@ -347,6 +269,7 @@ canvas_realize (GtkWidget *widget, EMultiConfigDialog *dialog) { int i; int row_count; + row_count = e_table_model_row_count (dialog->priv->list_e_table_model); for (i = 0; i < row_count; i++) { fill_in_pixbufs (dialog, i); @@ -431,9 +354,7 @@ init (EMultiConfigDialog *multi_config_dialog) gtk_dialog_add_buttons (GTK_DIALOG (multi_config_dialog), GTK_STOCK_HELP, GTK_RESPONSE_HELP, - GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response (GTK_DIALOG (multi_config_dialog), GTK_RESPONSE_OK); @@ -448,7 +369,6 @@ init (EMultiConfigDialog *multi_config_dialog) priv->list_e_table = list_e_table; priv->list_e_table_model = list_e_table_model; priv->notebook = notebook; - priv->num_unapplied = 0; priv->set_page_timeout_id = 0; priv->set_page_timeout_page = 0; @@ -466,7 +386,7 @@ e_multi_config_dialog_new (void) return GTK_WIDGET (dialog); } - + void e_multi_config_dialog_add_page (EMultiConfigDialog *dialog, const char *title, @@ -504,13 +424,6 @@ e_multi_config_dialog_add_page (EMultiConfigDialog *dialog, e_table_set_cursor_row (table, 0); e_selection_model_select_all (e_table_get_selection_model (table)); } - - if (! e_config_page_is_applied (page_widget)) - priv->num_unapplied ++; - - g_signal_connect (page_widget, "changed", G_CALLBACK (page_changed_callback), dialog); - - update_buttons (dialog); } void @@ -527,5 +440,5 @@ e_multi_config_dialog_show_page (EMultiConfigDialog *dialog, int page) gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), page); } - + E_MAKE_TYPE (e_multi_config_dialog, "EMultiConfigDialog", EMultiConfigDialog, class_init, init, PARENT_TYPE) |