[eog/wip/gaction-migration] EogPropertiesDialog: migrate to GAction



commit 09fe55c6ca5206668db2da20f751fbe690437947
Author: Jente Hidskes <hjdskes gmail com>
Date:   Tue Dec 23 23:04:49 2014 +0100

    EogPropertiesDialog: migrate to GAction
    
    This patch takes care of the GAction migration in EogPropertiesDialog.
    It should be considered a draft, as it is not working yet.
    
    There is one thing to note: the action names for the dialog are now
    hardcoded in EogWindow.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741050

 src/eog-properties-dialog.c |   24 ++++++++++++------------
 src/eog-properties-dialog.h |    4 ++--
 src/eog-window.c            |   13 ++-----------
 3 files changed, 16 insertions(+), 25 deletions(-)
---
diff --git a/src/eog-properties-dialog.c b/src/eog-properties-dialog.c
index c2296fe..765b423 100644
--- a/src/eog-properties-dialog.c
+++ b/src/eog-properties-dialog.c
@@ -483,13 +483,13 @@ eog_properties_dialog_set_property (GObject      *object,
                                                   g_value_get_boolean (value));
                        break;
                case PROP_NEXT_ACTION:
-                       gtk_activatable_set_related_action (GTK_ACTIVATABLE (prop_dlg->priv->next_button),
-                                                           g_value_get_object(value));
+                       gtk_actionable_set_action_name (GTK_ACTIONABLE (prop_dlg->priv->next_button),
+                                                           g_value_get_string (value));
                        gtk_button_set_always_show_image(GTK_BUTTON(prop_dlg->priv->next_button), TRUE);
                        break;
                case PROP_PREV_ACTION:
-                       gtk_activatable_set_related_action (GTK_ACTIVATABLE (prop_dlg->priv->previous_button),
-                                                           g_value_get_object(value));
+                       gtk_actionable_set_action_name (GTK_ACTIONABLE (prop_dlg->priv->previous_button),
+                                                           g_value_get_string (value));
                        gtk_button_set_always_show_image(GTK_BUTTON(prop_dlg->priv->previous_button), TRUE);
                        break;
                default:
@@ -574,10 +574,10 @@ eog_properties_dialog_class_init (EogPropertiesDialogClass *klass)
                                                              G_PARAM_STATIC_STRINGS));
        g_object_class_install_property (g_object_class,
                                         PROP_NEXT_ACTION,
-                                        g_param_spec_object ("next-action",
+                                        g_param_spec_string ("next-action",
                                                              "Next Action",
                                                              "Action for Next button",
-                                                             GTK_TYPE_ACTION,
+                                                             "win.go-next",
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_CONSTRUCT_ONLY |
                                                              G_PARAM_STATIC_NAME |
@@ -585,10 +585,10 @@ eog_properties_dialog_class_init (EogPropertiesDialogClass *klass)
                                                              G_PARAM_STATIC_BLURB));
        g_object_class_install_property (g_object_class,
                                         PROP_PREV_ACTION,
-                                        g_param_spec_object ("prev-action",
+                                        g_param_spec_string ("prev-action",
                                                              "Prev Action",
                                                              "Action for Prev button",
-                                                             GTK_TYPE_ACTION,
+                                                             "win.go-previous",
                                                              G_PARAM_READWRITE |
                                                              G_PARAM_CONSTRUCT_ONLY |
                                                              G_PARAM_STATIC_NAME |
@@ -798,15 +798,15 @@ eog_properties_dialog_init (EogPropertiesDialog *prop_dlg)
 GtkWidget *
 eog_properties_dialog_new (GtkWindow    *parent,
                           EogThumbView *thumbview,
-                          GtkAction    *next_image_action,
-                          GtkAction    *previous_image_action)
+                          const gchar  *next_image_action,
+                          const gchar  *previous_image_action)
 {
        GObject *prop_dlg;
 
        g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL);
        g_return_val_if_fail (EOG_IS_THUMB_VIEW (thumbview), NULL);
-       g_return_val_if_fail (GTK_IS_ACTION (next_image_action), NULL);
-       g_return_val_if_fail (GTK_IS_ACTION (previous_image_action), NULL);
+       g_return_val_if_fail (next_image_action != NULL, NULL);
+       g_return_val_if_fail (previous_image_action != NULL, NULL);
 
        prop_dlg = g_object_new (EOG_TYPE_PROPERTIES_DIALOG,
                                 "thumbview", thumbview,
diff --git a/src/eog-properties-dialog.h b/src/eog-properties-dialog.h
index 1bc7333..0b27336 100644
--- a/src/eog-properties-dialog.h
+++ b/src/eog-properties-dialog.h
@@ -63,8 +63,8 @@ GType     eog_properties_dialog_get_type      (void) G_GNUC_CONST;
 
 GtkWidget  *eog_properties_dialog_new          (GtkWindow               *parent,
                                                 EogThumbView            *thumbview,
-                                                GtkAction               *next_image_action,
-                                                GtkAction               *previous_image_action);
+                                                const gchar             *next_image_action,
+                                                const gchar             *previous_image_action);
 
 void       eog_properties_dialog_update        (EogPropertiesDialog     *prop,
                                                 EogImage                *image);
diff --git a/src/eog-window.c b/src/eog-window.c
index 12c7aa9..863687c 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -2972,20 +2972,11 @@ eog_window_get_properties_dialog (EogWindow *window)
        priv = window->priv;
 
        if (priv->properties_dlg == NULL) {
-               GAction *next_image_action, *previous_image_action;
-
-               next_image_action =
-                       g_action_map_lookup_action (G_ACTION_MAP (window),
-                                                    "go-next");
-
-               previous_image_action =
-                       g_action_map_lookup_action (G_ACTION_MAP (window),
-                                                    "go-previous");
                priv->properties_dlg =
                        eog_properties_dialog_new (GTK_WINDOW (window),
                                                   EOG_THUMB_VIEW (priv->thumbview),
-                                                  next_image_action,
-                                                  previous_image_action);
+                                                  "win.go-next",
+                                                  "win.go-previous");
 
                eog_properties_dialog_update (EOG_PROPERTIES_DIALOG (priv->properties_dlg),
                                              priv->image);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]