window: fix missing icons from calendar management menu

This commit is contained in:
Georges Basile Stavracas Neto
2015-01-13 13:23:10 -02:00
parent b44f14bdf2
commit 6094cb7b69
2 changed files with 13 additions and 2 deletions
+4
View File
@@ -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>
+9 -2
View File
@@ -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);