source-dialog: implement "Add" button menu
The actions are still stub.
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
2667a0860e
commit
e203887484
@@ -38,4 +38,20 @@
|
|||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
|
<menu id="add-source-menu">
|
||||||
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">From Web…</attribute>
|
||||||
|
<attribute name="action">source.web</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">New Local Calendar…</attribute>
|
||||||
|
<attribute name="action">source.local</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">From File…</attribute>
|
||||||
|
<attribute name="action">source.file</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
|
</menu>
|
||||||
</interface>
|
</interface>
|
||||||
|
|||||||
@@ -1218,6 +1218,8 @@ gcal_source_dialog_constructed (GObject *object)
|
|||||||
GcalSourceDialog *self = (GcalSourceDialog *)object;
|
GcalSourceDialog *self = (GcalSourceDialog *)object;
|
||||||
GcalSourceDialogPrivate *priv = gcal_source_dialog_get_instance_private (self);
|
GcalSourceDialogPrivate *priv = gcal_source_dialog_get_instance_private (self);
|
||||||
GtkFileFilter *filter;
|
GtkFileFilter *filter;
|
||||||
|
GtkBuilder *builder;
|
||||||
|
GMenuModel *menu;
|
||||||
|
|
||||||
G_OBJECT_CLASS (gcal_source_dialog_parent_class)->constructed (object);
|
G_OBJECT_CLASS (gcal_source_dialog_parent_class)->constructed (object);
|
||||||
|
|
||||||
@@ -1245,6 +1247,14 @@ gcal_source_dialog_constructed (GObject *object)
|
|||||||
|
|
||||||
g_action_map_add_action_entries (G_ACTION_MAP (priv->action_group), actions, G_N_ELEMENTS (actions), object);
|
g_action_map_add_action_entries (G_ACTION_MAP (priv->action_group), actions, G_N_ELEMENTS (actions), object);
|
||||||
|
|
||||||
|
// Load the "Add" button menu
|
||||||
|
builder = gtk_builder_new_from_resource ("/org/gnome/calendar/menus.ui");
|
||||||
|
|
||||||
|
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "add-source-menu"));
|
||||||
|
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->add_calendar_menu_button), menu);
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
|
|
||||||
/* setup titlebar */
|
/* setup titlebar */
|
||||||
gtk_window_set_titlebar (GTK_WINDOW (object), priv->headerbar);
|
gtk_window_set_titlebar (GTK_WINDOW (object), priv->headerbar);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user