[gnome-calendar] window: fix missing icons from calendar management menu



commit 6094cb7b695fe2a12f44b0be87e5a63ba279de09
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jan 13 13:23:10 2015 -0200

    window: fix missing icons from calendar management menu

 data/ui/window.ui |    4 ++++
 src/gcal-window.c |   11 +++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/window.ui b/data/ui/window.ui
index 9835d2e..a65e5ed 100644
--- a/data/ui/window.ui
+++ b/data/ui/window.ui
@@ -272,6 +272,7 @@
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="receives_default">True</property>
+            <property name="popover">calendar_popover</property>
             <child>
               <object class="GtkImage" id="calendars_button_image">
                 <property name="visible">True</property>
@@ -312,6 +313,9 @@
     <property name="relative_to">search_entry</property>
     <signal name="event-activated" handler="search_event_selected" object="GcalWindow" swapped="no"/>
   </object>
+  <object class="GtkPopover" id="calendar_popover">
+    <property name="visible">False</property>
+  </object>
   <object class="GtkPopover" id="popover">
     <property name="visible">False</property>
     <property name="relative_to">views_stack</property>
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 8625b90..2a57bb5 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -101,6 +101,7 @@ typedef struct
   GcalEventData       *event_to_delete;
 
   /* calendar management */
+  GtkWidget           *calendar_popover;
   GMenu               *calendar_menu;
   gint                 refresh_timeout;
   gint                 refresh_timeout_id;
@@ -183,6 +184,8 @@ static void           on_calendar_toggled                (GSimpleAction       *a
                                                           GVariant            *value,
                                                           gpointer             user_data);
 
+static void           fix_calendar_menu                  (GcalWindow          *window);
+
 static gboolean       refresh_sources                    (GcalWindow          *window);
 
 static gboolean       window_state_changed               (GtkWidget           *window,
@@ -690,7 +693,7 @@ add_source (GcalManager *manager,
   g_action_map_add_action (G_ACTION_MAP (user_data), G_ACTION (action));
 
   /* retrieve the source's color & build item name */
-  item_name = g_strdup_printf ("win.%s", e_source_get_uid (source));
+  item_name = g_strdup_printf ("%s", e_source_get_uid (source));
   extension = E_SOURCE_SELECTABLE (e_source_get_extension (source, E_SOURCE_EXTENSION_CALENDAR));
   gdk_rgba_parse (&color, e_source_selectable_get_color (E_SOURCE_SELECTABLE (extension)));
   pix = gcal_get_pixbuf_from_color (&color, 16);
@@ -701,6 +704,9 @@ add_source (GcalManager *manager,
   g_menu_item_set_icon (item, G_ICON (pix));
   g_menu_append_item (priv->calendar_menu, item);
 
+  /* HACK: show images of the popover menu */
+  fix_popover_menu_icons (GTK_POPOVER (priv->calendar_popover));
+
   g_object_unref (pix);
   g_object_unref (item);
   g_free (item_name);
@@ -1168,6 +1174,7 @@ gcal_window_class_init(GcalWindowClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, search_bar);
   gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, search_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, calendars_button);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, calendar_popover);
   gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, search_entry);
   gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, back_button);
   gtk_widget_class_bind_template_child_private (widget_class, GcalWindow, today_button);
@@ -1256,7 +1263,7 @@ gcal_window_constructed (GObject *object)
 
   /* calendar menu */
   priv->calendar_menu = g_menu_new ();
-  gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->calendars_button), G_MENU_MODEL 
(priv->calendar_menu));
+  gtk_popover_bind_model (GTK_POPOVER (priv->calendar_popover), G_MENU_MODEL (priv->calendar_menu), "win");
 
   /* edit dialog initialization */
   priv->edit_dialog = gcal_edit_dialog_new (use_24h_format);


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