diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-12-01 10:53:20 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2012-02-20 23:04:25 +0800 |
commit | 23f5773903d64a554d977ae7d0ebbaca73528f1f (patch) | |
tree | 104e1a59da8bf96b004bce204b79f47bbe0a6d13 /widgets/menus/gal-view-new-dialog.c | |
parent | 49bc4c2d765ee1780c23fdc9f42152850dabb220 (diff) | |
download | gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.gz gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.tar.zst gsoc2013-evolution-23f5773903d64a554d977ae7d0ebbaca73528f1f.zip |
Coding style and whitespace cleanup.
Diffstat (limited to 'widgets/menus/gal-view-new-dialog.c')
-rw-r--r-- | widgets/menus/gal-view-new-dialog.c | 224 |
1 files changed, 111 insertions, 113 deletions
diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c index c26619f2bd..36d742963a 100644 --- a/widgets/menus/gal-view-new-dialog.c +++ b/widgets/menus/gal-view-new-dialog.c @@ -33,11 +33,6 @@ #include "gal-define-views-model.h" #include "gal-view-new-dialog.h" -static void gal_view_new_dialog_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec); -static void gal_view_new_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec); -static void gal_view_new_dialog_dispose (GObject *object); - -/* The arguments we take */ enum { PROP_0, PROP_NAME, @@ -47,29 +42,98 @@ enum { G_DEFINE_TYPE (GalViewNewDialog, gal_view_new_dialog, GTK_TYPE_DIALOG) static void -gal_view_new_dialog_class_init (GalViewNewDialogClass *klass) +gal_view_new_dialog_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) { - GObjectClass *object_class; + GalViewNewDialog *dialog; + GtkWidget *entry; + + dialog = GAL_VIEW_NEW_DIALOG (object); + + switch (property_id) { + case PROP_NAME: + entry = e_builder_get_widget(dialog->builder, "entry-name"); + if (entry && GTK_IS_ENTRY (entry)) { + gtk_entry_set_text (GTK_ENTRY (entry), g_value_get_string (value)); + } + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + return; + } +} + +static void +gal_view_new_dialog_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GalViewNewDialog *dialog; + GtkWidget *entry; + + dialog = GAL_VIEW_NEW_DIALOG (object); + + switch (property_id) { + case PROP_NAME: + entry = e_builder_get_widget(dialog->builder, "entry-name"); + if (entry && GTK_IS_ENTRY (entry)) { + g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (entry))); + } + break; + case PROP_FACTORY: + g_value_set_object (value, dialog->selected_factory); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} - object_class = (GObjectClass *) klass; +static void +gal_view_new_dialog_dispose (GObject *object) +{ + GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG (object); + + if (gal_view_new_dialog->builder) + g_object_unref (gal_view_new_dialog->builder); + gal_view_new_dialog->builder = NULL; + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (gal_view_new_dialog_parent_class)->dispose (object); +} + +static void +gal_view_new_dialog_class_init (GalViewNewDialogClass *class) +{ + GObjectClass *object_class; + object_class = G_OBJECT_CLASS (class); object_class->set_property = gal_view_new_dialog_set_property; object_class->get_property = gal_view_new_dialog_get_property; - object_class->dispose = gal_view_new_dialog_dispose; - - g_object_class_install_property (object_class, PROP_NAME, - g_param_spec_string ("name", - "Name", - NULL, - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FACTORY, - g_param_spec_object ("factory", - "Factory", - NULL, - GAL_TYPE_VIEW_FACTORY, - G_PARAM_READWRITE)); + object_class->dispose = gal_view_new_dialog_dispose; + + g_object_class_install_property ( + object_class, + PROP_NAME, + g_param_spec_string ( + "name", + "Name", + NULL, + NULL, + G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_FACTORY, + g_param_spec_object ( + "factory", + "Factory", + NULL, + GAL_TYPE_VIEW_FACTORY, + G_PARAM_READWRITE)); } static void @@ -111,19 +175,6 @@ gal_view_new_dialog_init (GalViewNewDialog *dialog) dialog->selected_factory = NULL; } -static void -gal_view_new_dialog_dispose (GObject *object) -{ - GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG (object); - - if (gal_view_new_dialog->builder) - g_object_unref (gal_view_new_dialog->builder); - gal_view_new_dialog->builder = NULL; - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (gal_view_new_dialog_parent_class)->dispose (object); -} - GtkWidget * gal_view_new_dialog_new (GalViewCollection *collection) { @@ -162,16 +213,10 @@ selection_func (GtkTreeSelection *selection, if (path_currently_selected) return TRUE; - gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->list_store), - &iter, - (GtkTreePath *) path); + model = GTK_TREE_MODEL (dialog->list_store); - gtk_tree_model_get (GTK_TREE_MODEL (dialog->list_store), - &iter, - 1, &dialog->selected_factory, - -1); - - printf ("%s factory selected\n", gal_view_factory_get_title(dialog->selected_factory)); + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (model, &iter, 1, &dialog->selected_factory, -1); sensitize_ok_response (dialog); @@ -199,15 +244,13 @@ gal_view_new_dialog_construct (GalViewNewDialog *dialog, dialog->collection = collection; dialog->list = e_builder_get_widget(dialog->builder,"list-type-list"); dialog->entry = e_builder_get_widget(dialog->builder, "entry-name"); - dialog->list_store = gtk_list_store_new (2, - G_TYPE_STRING, - G_TYPE_POINTER); + + dialog->list_store = gtk_list_store_new ( + 2, G_TYPE_STRING, G_TYPE_POINTER); rend = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes ("factory title", - rend, - "text", 0, - NULL); + column = gtk_tree_view_column_new_with_attributes ( + "factory title", rend, "text", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->list), column); @@ -217,75 +260,30 @@ gal_view_new_dialog_construct (GalViewNewDialog *dialog, GtkTreeIter iter; g_object_ref (factory); - gtk_list_store_append (dialog->list_store, - &iter); - gtk_list_store_set (dialog->list_store, - &iter, - 0, gal_view_factory_get_title (factory), - 1, factory, - -1); + gtk_list_store_append ( + dialog->list_store, &iter); + gtk_list_store_set ( + dialog->list_store, &iter, + 0, gal_view_factory_get_title (factory), + 1, factory, + -1); } - gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->list), GTK_TREE_MODEL (dialog->list_store)); + gtk_tree_view_set_model ( + GTK_TREE_VIEW (dialog->list), + GTK_TREE_MODEL (dialog->list_store)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list)); - gtk_tree_selection_set_select_function (selection, selection_func, dialog, NULL); - g_signal_connect (dialog->entry, "changed", - G_CALLBACK (entry_changed), dialog); + gtk_tree_selection_set_select_function ( + selection, selection_func, dialog, NULL); + + g_signal_connect ( + dialog->entry, "changed", + G_CALLBACK (entry_changed), dialog); sensitize_ok_response (dialog); return GTK_WIDGET (dialog); } -static void -gal_view_new_dialog_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - GalViewNewDialog *dialog; - GtkWidget *entry; - - dialog = GAL_VIEW_NEW_DIALOG (object); - - switch (property_id) { - case PROP_NAME: - entry = e_builder_get_widget(dialog->builder, "entry-name"); - if (entry && GTK_IS_ENTRY (entry)) { - gtk_entry_set_text (GTK_ENTRY (entry), g_value_get_string (value)); - } - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - return; - } -} - -static void -gal_view_new_dialog_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - GalViewNewDialog *dialog; - GtkWidget *entry; - - dialog = GAL_VIEW_NEW_DIALOG (object); - - switch (property_id) { - case PROP_NAME: - entry = e_builder_get_widget(dialog->builder, "entry-name"); - if (entry && GTK_IS_ENTRY (entry)) { - g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (entry))); - } - break; - case PROP_FACTORY: - g_value_set_object (value, dialog->selected_factory); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} |