edit-dialog: fix missing icons from source selection menu

This commit is contained in:
Georges Basile Stavracas Neto
2015-01-13 13:23:42 -02:00
parent 6094cb7b69
commit 6de2bdd292
2 changed files with 13 additions and 5 deletions
+4 -1
View File
@@ -164,7 +164,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="halign">start</property> <property name="halign">start</property>
<property name="use_popover">True</property> <property name="popover">sources_popover</property>
<child> <child>
<object class="GtkImage" id="source_image"> <object class="GtkImage" id="source_image">
<property name="visible">True</property> <property name="visible">True</property>
@@ -326,4 +326,7 @@
</object> </object>
</child> </child>
</template> </template>
<object class="GtkPopover" id="sources_popover">
<property name="visible">False</property>
</object>
</interface> </interface>
+9 -4
View File
@@ -44,6 +44,7 @@ typedef struct
GtkWidget *done_button; GtkWidget *done_button;
GtkWidget *cancel_button; GtkWidget *cancel_button;
GtkWidget *sources_button; GtkWidget *sources_button;
GtkWidget *sources_popover;
GtkWidget *summary_entry; GtkWidget *summary_entry;
@@ -141,17 +142,17 @@ fill_sources_menu (GcalEditDialog *dialog)
pix = gcal_get_pixbuf_from_color (&color, 16);; pix = gcal_get_pixbuf_from_color (&color, 16);;
/* menu item */ /* 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)); g_menu_item_set_icon (item, G_ICON (pix));
/* set insensitive for read-only calendars */ /* set insensitive for read-only calendars */
if (gcal_manager_is_client_writable (priv->manager, source)) 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 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))); g_variant_new_string (e_source_get_uid (source)));
} }
@@ -161,7 +162,10 @@ fill_sources_menu (GcalEditDialog *dialog)
g_object_unref (item); 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); 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, titlebar);
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, lock); 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, source_image);
gtk_widget_class_bind_template_child_private (widget_class, GcalEditDialog, sources_popover);
} }
static void static void