[gnome-todo] sidebar-list-row: Remove popover menu
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] sidebar-list-row: Remove popover menu
- Date: Fri, 1 Feb 2019 14:08:56 +0000 (UTC)
commit 2a0f0cf43ce89d11ba6241f0c056ea29544ad6a2
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Feb 1 12:05:40 2019 -0200
sidebar-list-row: Remove popover menu
All the relevant functionality was moved to the
window menu.
src/sidebar/gtd-sidebar-list-row.c | 60 -------------------------------------
src/sidebar/gtd-sidebar-list-row.ui | 31 -------------------
2 files changed, 91 deletions(-)
---
diff --git a/src/sidebar/gtd-sidebar-list-row.c b/src/sidebar/gtd-sidebar-list-row.c
index 4224304..2da5e9d 100644
--- a/src/sidebar/gtd-sidebar-list-row.c
+++ b/src/sidebar/gtd-sidebar-list-row.c
@@ -40,9 +40,6 @@ struct _GtdSidebarListRow
GtkLabel *name_label;
GtkLabel *tasks_counter_label;
- GActionMap *action_group;
- GMenu *menu;
-
GtdTaskList *list;
};
@@ -103,8 +100,6 @@ static void
set_list (GtdSidebarListRow *self,
GtdTaskList *list)
{
- GSimpleAction *delete_action;
-
g_assert (list != NULL);
g_assert (self->list == NULL);
@@ -127,28 +122,6 @@ set_list (GtdSidebarListRow *self,
g_signal_connect_object (list, "notify::color", G_CALLBACK (on_list_color_changed_cb), self, 0);
update_color_icon (self);
-
- /* Disable the delete action if task is not writable */
- delete_action = G_SIMPLE_ACTION (g_action_map_lookup_action (self->action_group, "delete"));
-
- g_object_bind_property (list,
- "is-removable",
- delete_action,
- "enabled",
- G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
-}
-
-static void
-popup_menu (GtdSidebarListRow *self)
-{
- GtkWidget *popover;
-
- popover = gtk_popover_new_from_model (GTK_WIDGET (self), G_MENU_MODEL (self->menu));
- gtk_widget_set_size_request (popover, 150, -1);
-
- g_signal_connect (popover, "hide", G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_popover_popup (GTK_POPOVER (popover));
}
@@ -156,28 +129,6 @@ popup_menu (GtdSidebarListRow *self)
* Callbacks
*/
-static void
-on_gesture_multipress_released_cb (GtkGesture *gesture,
- guint n_press,
- gdouble x,
- gdouble y,
- GtdSidebarListRow *self)
-{
- if (n_press > 1)
- return;
-
- popup_menu (self);
-}
-
-static void
-on_gesture_long_press_cb (GtkGesture *gesture,
- gdouble x,
- gdouble y,
- GtdSidebarListRow *self)
-{
- popup_menu (self);
-}
-
static void
on_list_changed_cb (GtdSidebarListRow *self)
{
@@ -215,7 +166,6 @@ gtd_sidebar_list_row_finalize (GObject *object)
GtdSidebarListRow *self = (GtdSidebarListRow *)object;
g_clear_object (&self->list);
- g_clear_object (&self->action_group);
G_OBJECT_CLASS (gtd_sidebar_list_row_parent_class)->finalize (object);
}
@@ -279,26 +229,16 @@ gtd_sidebar_list_row_class_init (GtdSidebarListRowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/todo/ui/sidebar/gtd-sidebar-list-row.ui");
gtk_widget_class_bind_template_child (widget_class, GtdSidebarListRow, color_icon);
- gtk_widget_class_bind_template_child (widget_class, GtdSidebarListRow, menu);
gtk_widget_class_bind_template_child (widget_class, GtdSidebarListRow, name_label);
gtk_widget_class_bind_template_child (widget_class, GtdSidebarListRow, tasks_counter_label);
- gtk_widget_class_bind_template_callback (widget_class, on_gesture_long_press_cb);
- gtk_widget_class_bind_template_callback (widget_class, on_gesture_multipress_released_cb);
gtk_widget_class_bind_template_callback (widget_class, on_rename_popover_hidden_cb);
}
static void
gtd_sidebar_list_row_init (GtdSidebarListRow *self)
{
- const GActionEntry entries[] = { };
-
gtk_widget_init_template (GTK_WIDGET (self));
-
- /* Actions */
- self->action_group = G_ACTION_MAP (g_simple_action_group_new ());
- g_action_map_add_action_entries (self->action_group, entries, G_N_ELEMENTS (entries), self);
- gtk_widget_insert_action_group (GTK_WIDGET (self), "list-row", G_ACTION_GROUP (self->action_group));
}
GtkWidget*
diff --git a/src/sidebar/gtd-sidebar-list-row.ui b/src/sidebar/gtd-sidebar-list-row.ui
index b371eb3..3b2a2a4 100644
--- a/src/sidebar/gtd-sidebar-list-row.ui
+++ b/src/sidebar/gtd-sidebar-list-row.ui
@@ -4,23 +4,6 @@
<template class="GtdSidebarListRow" parent="GtkListBoxRow">
<property name="can_focus">True</property>
- <!-- Gestures -->
- <child>
- <object class="GtkGestureLongPress">
- <property name="propagation-phase">target</property>
- <property name="touch-only">true</property>
- <signal name="pressed" handler="on_gesture_long_press_cb" object="GtdSidebarListRow" swapped="no" />
- </object>
- </child>
- <child>
- <object class="GtkGestureMultiPress">
- <property name="propagation-phase">bubble</property>
- <property name="touch-only">false</property>
- <property name="button">3</property>
- <signal name="pressed" handler="on_gesture_multipress_released_cb" object="GtdSidebarListRow"
swapped="no" />
- </object>
- </child>
-
<child>
<object class="GtkBox">
<property name="can_focus">False</property>
@@ -60,18 +43,4 @@
</child>
</template>
- <!-- Right-click menu -->
- <menu id="menu">
- <section>
- <item>
- <attribute name="label" translatable="yes">Rename</attribute>
- <attribute name="action">list-row.rename</attribute>
- </item>
- <item>
- <attribute name="label" translatable="yes">Delete</attribute>
- <attribute name="action">list-row.delete</attribute>
- </item>
- </section>
- </menu>
-
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]