[empathy] Add the app menu using the same model as the menu button



commit 7c2acbdf93266e68a9694a54393afabcd534dfaf
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Wed May 9 16:28:06 2012 +1000

    Add the app menu using the same model as the menu button

 src/empathy-roster-window.c |   10 ++++++++++
 src/empathy.c               |   15 +++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index 32cd192..f2549b8 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -2570,6 +2570,15 @@ empathy_roster_window_get_property (GObject    *object,
 }
 
 static void
+empathy_roster_window_constructed (GObject *self)
+{
+  G_OBJECT_CLASS (empathy_roster_window_parent_class)->constructed (self);
+
+  gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (self),
+      FALSE);
+}
+
+static void
 empathy_roster_window_class_init (EmpathyRosterWindowClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -2577,6 +2586,7 @@ empathy_roster_window_class_init (EmpathyRosterWindowClass *klass)
 
   object_class->finalize = empathy_roster_window_finalize;
   object_class->constructor = empathy_roster_window_constructor;
+  object_class->constructed = empathy_roster_window_constructed;
 
   object_class->set_property = empathy_roster_window_set_property;
   object_class->get_property = empathy_roster_window_get_property;
diff --git a/src/empathy.c b/src/empathy.c
index 712632f..774365b 100644
--- a/src/empathy.c
+++ b/src/empathy.c
@@ -332,6 +332,9 @@ empathy_app_command_line (GApplication *app,
     {
       GError *error = NULL;
       TpDBusDaemon *dbus;
+      GtkBuilder *gui;
+      GMenuModel *menu;
+      char *filename;
 
       /* Create the FT factory */
       self->ft_factory = empathy_ft_factory_dup_singleton ();
@@ -349,6 +352,18 @@ empathy_app_command_line (GApplication *app,
 
       self->activated = TRUE;
 
+      /* set up the app menu */
+      filename = empathy_file_lookup (
+          "empathy-roster-window-menubar.ui", "src");
+      gui = empathy_builder_get_file (filename,
+          "menubutton", &menu,
+          NULL);
+
+      gtk_application_set_app_menu (GTK_APPLICATION (self), menu);
+
+      g_free (filename);
+      g_object_unref (gui);
+
       /* Setting up UI */
       self->window = empathy_roster_window_new (GTK_APPLICATION (app));
 



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