[recipes] Refine the drag handle for ingredients
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Refine the drag handle for ingredients
- Date: Fri, 12 May 2017 01:50:20 +0000 (UTC)
commit 93e1fc388ac5f22b62dc6b5ced6403b674a76cf8
Author: Matthias Clasen <mclasen redhat com>
Date: Thu May 11 21:37:08 2017 -0400
Refine the drag handle for ingredients
Make this look like Jakub's mockup.
https://bugzilla.gnome.org/show_bug.cgi?id=782522
src/gr-ingredients-viewer-row.c | 22 ++++++++--------------
src/gr-ingredients-viewer-row.ui | 37 ++++++++++++++-----------------------
src/recipes.css | 5 +++++
3 files changed, 27 insertions(+), 37 deletions(-)
---
diff --git a/src/gr-ingredients-viewer-row.c b/src/gr-ingredients-viewer-row.c
index 2ca9de7..3edbb58 100644
--- a/src/gr-ingredients-viewer-row.c
+++ b/src/gr-ingredients-viewer-row.c
@@ -41,7 +41,7 @@ struct _GrIngredientsViewerRow
GtkWidget *ingredient_stack;
GtkWidget *ingredient_label;
GtkWidget *ingredient_entry;
- GtkWidget *ebox;
+ GtkWidget *drag_handle;
GtkWidget *unit_event_box;
GtkWidget *ingredient_event_box;
@@ -254,11 +254,6 @@ emit_delete (GrIngredientsViewerRow *row)
}
static void
-drag_handle_clicked (GrIngredientsViewerRow *row)
-{
-}
-
-static void
edit_ingredient (GrIngredientsViewerRow *row)
{
GrIngredientsViewer *viewer;
@@ -476,12 +471,11 @@ gr_ingredients_viewer_row_class_init (GrIngredientsViewerRowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GrIngredientsViewerRow, ingredient_label);
gtk_widget_class_bind_template_child (widget_class, GrIngredientsViewerRow, ingredient_entry);
gtk_widget_class_bind_template_child (widget_class, GrIngredientsViewerRow, buttons_stack);
- gtk_widget_class_bind_template_child (widget_class, GrIngredientsViewerRow, ebox);
+ gtk_widget_class_bind_template_child (widget_class, GrIngredientsViewerRow, drag_handle);
gtk_widget_class_bind_template_child (widget_class, GrIngredientsViewerRow, unit_event_box);
gtk_widget_class_bind_template_child (widget_class, GrIngredientsViewerRow, ingredient_event_box);
gtk_widget_class_bind_template_callback (widget_class, emit_delete);
- gtk_widget_class_bind_template_callback (widget_class, drag_handle_clicked);
gtk_widget_class_bind_template_callback (widget_class, edit_unit);
gtk_widget_class_bind_template_callback (widget_class, edit_unit_or_focus_out);
gtk_widget_class_bind_template_callback (widget_class, edit_ingredient);
@@ -706,9 +700,9 @@ setup_editable_row (GrIngredientsViewerRow *self)
g_autoptr(GtkTreeModel) ingredients_model = NULL;
g_autoptr(GtkTreeModel) units_model = NULL;
- gtk_drag_source_set (self->ebox, GDK_BUTTON1_MASK, entries, 1, GDK_ACTION_MOVE);
- g_signal_connect (self->ebox, "drag-begin", G_CALLBACK (drag_begin), NULL);
- g_signal_connect (self->ebox, "drag-data-get", G_CALLBACK (drag_data_get), NULL);
+ gtk_drag_source_set (self->drag_handle, GDK_BUTTON1_MASK, entries, 1, GDK_ACTION_MOVE);
+ g_signal_connect (self->drag_handle, "drag-begin", G_CALLBACK (drag_begin), NULL);
+ g_signal_connect (self->drag_handle, "drag-data-get", G_CALLBACK (drag_data_get), NULL);
gtk_drag_dest_set (GTK_WIDGET (self), GTK_DEST_DEFAULT_ALL, entries, 1, GDK_ACTION_MOVE);
g_signal_connect (self, "drag-data-received", G_CALLBACK (drag_data_received), NULL);
@@ -726,9 +720,9 @@ setup_editable_row (GrIngredientsViewerRow *self)
gtk_entry_set_completion (GTK_ENTRY (self->unit_entry), completion);
}
else {
- gtk_drag_source_unset (self->ebox);
- g_signal_handlers_disconnect_by_func (self->ebox, drag_begin, NULL);
- g_signal_handlers_disconnect_by_func (self->ebox, drag_data_get, NULL);
+ gtk_drag_source_unset (self->drag_handle);
+ g_signal_handlers_disconnect_by_func (self->drag_handle, drag_begin, NULL);
+ g_signal_handlers_disconnect_by_func (self->drag_handle, drag_data_get, NULL);
gtk_drag_dest_unset (GTK_WIDGET (self));
g_signal_handlers_disconnect_by_func (self, drag_data_received, NULL);
diff --git a/src/gr-ingredients-viewer-row.ui b/src/gr-ingredients-viewer-row.ui
index 85b0ecf..9ecbad3 100644
--- a/src/gr-ingredients-viewer-row.ui
+++ b/src/gr-ingredients-viewer-row.ui
@@ -7,8 +7,20 @@
<object class="GtkBox" id="box">
<property name="visible">1</property>
<property name="spacing">10</property>
- <property name="margin-start">6</property>
- <property name="margin-end">6</property>
+ <child>
+ <object class="GtkEventBox" id="drag_handle">
+ <property name="visible" bind-source="GrIngredientsViewerRow" bind-property="editable"
bind-flags="default|sync-create"/>
+ <style>
+ <class name="drag-handle"/>
+ </style>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">1</property>
+ <property name="icon-name">view-more-symbolic</property>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="GtkStack" id="unit_stack">
<property name="visible">1</property>
@@ -127,27 +139,6 @@
</child>
</object>
</child>
- <child>
- <object class="GtkButton" id="ebox">
- <property name="visible">1</property>
- <property name="relief">none</property>
- <signal name="clicked" handler="drag_handle_clicked" swapped="yes"/>
- <signal name="focus-in-event" handler="save_row" swapped="yes" after="yes"/>
- <signal name="key-press-event" handler="drag_key_press"/>
- <style>
- <class name="image-button"/>
- <class name="circular"/>
- </style>
- <child>
- <object class="GtkImage">
- <property name="visible">1</property>
- <property name="icon-name">open-menu-symbolic</property>
- <property name="icon-size">1</property>
- <property name="margin">4</property>
- </object>
- </child>
- </object>
- </child>
</object>
<packing>
<property name="name">buttons</property>
diff --git a/src/recipes.css b/src/recipes.css
index 7bbd1b1..48d97ea 100644
--- a/src/recipes.css
+++ b/src/recipes.css
@@ -436,3 +436,8 @@ dialog.about image.logo-image.small {
dialog.about box.dialog-vbox {
min-height: 460px;
}
+
+.drag-handle {
+ opacity: 0.333;
+ border-right: 1px solid gray;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]