[gnome-photos/wip/search: 14/22] application: Split out the app menu creation into its own function



commit dce6a202d687f83a3afe4ffeaa687b170a93744c
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 18 13:51:48 2014 +0100

    application: Split out the app menu creation into its own function
    
    This keeps the code in sync with gnome-documents.

 src/photos-application.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 4e8e2b2..b8ed612 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -167,6 +167,21 @@ photos_application_fullscreen (PhotosApplication *self, GVariant *parameter)
 
 
 static void
+photos_application_init_app_menu (PhotosApplication *self)
+{
+  GMenu *menu;
+  GtkBuilder *builder;
+
+  builder = gtk_builder_new ();
+  gtk_builder_add_from_resource (builder, "/org/gnome/photos/app-menu.ui", NULL);
+
+  menu = G_MENU (gtk_builder_get_object (builder, "app-menu"));
+  gtk_application_set_app_menu (GTK_APPLICATION (self), G_MENU_MODEL (menu));
+  g_object_unref (builder);
+}
+
+
+static void
 photos_application_launch_search (PhotosApplication *self, const gchar* const *terms, guint timestamp)
 {
 }
@@ -488,10 +503,8 @@ photos_application_startup (GApplication *application)
   PhotosApplication *self = PHOTOS_APPLICATION (application);
   PhotosApplicationPrivate *priv = self->priv;
   GError *error;
-  GMenu *menu;
   GSimpleAction *action;
   GrlRegistry *registry;
-  GtkBuilder *builder;
   GtkSettings *settings;
   GVariant *state;
 
@@ -601,12 +614,7 @@ photos_application_startup (GApplication *application)
                             G_CALLBACK (photos_application_window_mode_changed),
                             self);
 
-  builder = gtk_builder_new ();
-  gtk_builder_add_from_resource (builder, "/org/gnome/photos/app-menu.ui", NULL);
-
-  menu = G_MENU (gtk_builder_get_object (builder, "app-menu"));
-  gtk_application_set_app_menu (GTK_APPLICATION (self), G_MENU_MODEL (menu));
-  g_object_unref (builder);
+  photos_application_init_app_menu (self);
 
   gtk_application_add_accelerator (GTK_APPLICATION (self), "<Primary>q", "app.quit", NULL);
   gtk_application_add_accelerator (GTK_APPLICATION (self), "F11", "app.fullscreen", NULL);


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