[gnome-calendar] edit-dialog: fix missing icons from source selection menu



commit 6de2bdd2922682b2d72a45e533dd1ed0bfcb4011
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jan 13 13:23:42 2015 -0200

    edit-dialog: fix missing icons from source selection menu

 data/ui/edit-dialog.ui |    5 ++++-
 src/gcal-edit-dialog.c |   13 +++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index c152047..e17a682 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -164,7 +164,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="halign">start</property>
-                <property name="use_popover">True</property>
+                <property name="popover">sources_popover</property>
                 <child>
                   <object class="GtkImage" id="source_image">
                     <property name="visible">True</property>
@@ -326,4 +326,7 @@
       </object>
     </child>
   </template>
+  <object class="GtkPopover" id="sources_popover">
+    <property name="visible">False</property>
+  </object>
 </interface>
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 6c919ff..fce91c2 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -44,6 +44,7 @@ typedef struct
   GtkWidget        *done_button;
   GtkWidget        *cancel_button;
   GtkWidget        *sources_button;
+  GtkWidget        *sources_popover;
 
   GtkWidget        *summary_entry;
 
@@ -141,17 +142,17 @@ fill_sources_menu (GcalEditDialog *dialog)
       pix = gcal_get_pixbuf_from_color (&color, 16);;
 
       /* menu item */
-      item = g_menu_item_new (e_source_get_display_name (source), "edit.select_calendar");
+      item = g_menu_item_new (e_source_get_display_name (source), "select_calendar");
       g_menu_item_set_icon (item, G_ICON (pix));
 
       /* set insensitive for read-only calendars */
       if (gcal_manager_is_client_writable (priv->manager, source))
         {
-          g_menu_item_set_action_and_target_value (item, "edit.select_calendar", NULL);
+          g_menu_item_set_action_and_target_value (item, "select_calendar", NULL);
         }
       else
         {
-          g_menu_item_set_action_and_target_value (item, "edit.select_calendar",
+          g_menu_item_set_action_and_target_value (item, "select_calendar",
                                                    g_variant_new_string (e_source_get_uid (source)));
         }
 
@@ -161,7 +162,10 @@ fill_sources_menu (GcalEditDialog *dialog)
       g_object_unref (item);
     }
 
-  gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->sources_button), G_MENU_MODEL (priv->sources_menu));
+  gtk_popover_bind_model (GTK_POPOVER (priv->sources_popover), G_MENU_MODEL (priv->sources_menu), "edit");
+
+  /* HACK: show the popover menu icons */
+  fix_popover_menu_icons (GTK_POPOVER (priv->sources_popover));
 
   g_list_free (list);
 }
@@ -479,6 +483,7 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, titlebar);
   gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, lock);
   gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, source_image);
+  gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, sources_popover);
 }
 
 static void


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