[almanah] Bug 684412 Simplified the tags area widget.



commit ecdff3cf9c94eae44eff145b0abe88f4e1880f85
Author: Álvaro Peña <alvaropg gmail com>
Date:   Wed Sep 4 18:26:10 2013 +0200

    Bug 684412 Simplified the tags area widget.
    
    Removed all the custom container stuff about style and added a button in the toolbar
    to show/hide the tags zone.

 configure.ac                                  |    1 +
 data/almanah.css                              |   20 ------
 data/almanah.ui                               |   19 +++++-
 data/icons/Makefile.am                        |    2 +-
 data/icons/scalable/Makefile.am               |    6 ++
 data/icons/scalable/almanah-tags-symbolic.svg |   81 +++++++++++++++++++++++++
 src/main-window.c                             |   18 ++++++
 src/widgets/entry-tags-area.c                 |   22 ++-----
 8 files changed, 130 insertions(+), 39 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 53af478..572e79c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -167,6 +167,7 @@ data/icons/16x16/Makefile
 data/icons/22x22/Makefile
 data/icons/32x32/Makefile
 data/icons/48x48/Makefile
+data/icons/scalable/Makefile
 data/org.gnome.almanah.gschema.xml.in
 ])
 AC_OUTPUT
diff --git a/data/almanah.css b/data/almanah.css
index a609f76..c944bd2 100644
--- a/data/almanah.css
+++ b/data/almanah.css
@@ -1,9 +1,5 @@
 AlmanahMainWindow GtkToolbar {
-    border-style: solid;
-    border-radius: 0px;
     border-width: 0px;
-    border-top-width: 0px;
-    border-bottom-width: 1px;
 }
 
 AlmanahCalendarButton:active {
@@ -28,25 +24,9 @@ AlmanahCalendarWindow {
     background-color: @menu_bg_color;
 }
 
-AlmanahEntryTagsArea {
-    background-color: #fff;
-}
-
-AlmanahEntryTagsArea:backdrop {
-    background-color: @theme_unfocused_base_color;
-}
-
 AlmanahTagEntry {
    color: #aaa;
    font-size: 8px;
-   border-width: 0px;
-   border-style: none;
-   border-radius: 0px;
-   margin: 0px;
-   padding: 10px;
-   box-shadow: none;
-   background-color: #fff;
-   background-image: none;
    transition: none;
 }
 
diff --git a/data/almanah.ui b/data/almanah.ui
index 5715b7b..e1b4cb3 100644
--- a/data/almanah.ui
+++ b/data/almanah.ui
@@ -100,6 +100,15 @@
                                        <accelerator key="M" modifiers="GDK_CONTROL_MASK"/>
                                </child>
                                <child>
+                                       <object class="GtkToggleAction" id="almanah_ui_show_tags">
+                                               <property name="name">show-tags</property>
+                                               <property name="label" translatable="yes">Show tags</property>
+                                               <property name="tooltip" translatable="yes">Show tags for the 
current entry</property>
+                                               <property name="icon-name">almanah-tags-symbolic</property>
+                                               <signal name="activate" handler="mw_show_tags_activate_cb"/>
+                                       </object>
+                               </child>
+                               <child>
                                        <object class="GtkAction" id="almanah_ui_help">
                                                <property name="name">help</property>
                                                <property name="label" translatable="yes">_Help</property>
@@ -223,12 +232,16 @@
                                                                </style>
                                                                <child>
                                                                        <object class="AlmanahEntryTagsArea" 
id="almanah_mw_entry_tags_area">
+                                                                               <property 
name="visible">False</property>
+                                                                               <property 
name="no-show-all">True</property>
+                                                                               <property 
name="vexpand">False</property>
                                                                                <property 
name="hexpand">True</property>
                                                                                <property 
name="horizontal-spacing">6</property>
                                                                                <property 
name="vertical-spacing">6</property>
-                                                                               <property 
name="margin_top">0</property>
-                                                                               <property 
name="margin_left">0</property>
-                                                                               <property 
name="margin_right">0</property>
+                                                                               <property 
name="margin_top">6</property>
+                                                                               <property 
name="margin_left">6</property>
+                                                                               <property 
name="margin_right">6</property>
+                                                                               <property 
name="margin_bottom">6</property>
                                                                        </object>
                                                                        <packing>
                                                                                <property 
name="left_attach">0</property>
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index da9f9a8..3218a12 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -1,3 +1,3 @@
-SUBDIRS = 16x16 22x22 32x32 48x48
+SUBDIRS = 16x16 22x22 32x32 48x48 scalable
 
 -include $(top_srcdir)/git.mk
diff --git a/data/icons/scalable/Makefile.am b/data/icons/scalable/Makefile.am
new file mode 100644
index 0000000..76a9228
--- /dev/null
+++ b/data/icons/scalable/Makefile.am
@@ -0,0 +1,6 @@
+icondir = $(datadir)/icons/hicolor/scalable/actions
+icon_DATA = almanah-tags-symbolic.svg
+
+EXTRA_DIST = $(icon_DATA)
+
+-include ($top_srcdir)/git.mk
diff --git a/data/icons/scalable/almanah-tags-symbolic.svg b/data/icons/scalable/almanah-tags-symbolic.svg
new file mode 100644
index 0000000..2be15a7
--- /dev/null
+++ b/data/icons/scalable/almanah-tags-symbolic.svg
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="16"
+   height="16"
+   id="svg5190"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="tags_symbolic.svg">
+  <defs
+     id="defs5192" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#3a3b39"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="1"
+     inkscape:pageshadow="2"
+     inkscape:zoom="32"
+     inkscape:cx="5.4897854"
+     inkscape:cy="10.282453"
+     inkscape:document-units="px"
+     inkscape:current-layer="g43077"
+     showgrid="false"
+     showguides="true"
+     inkscape:guide-bbox="true"
+     showborder="false"
+     inkscape:window-width="1375"
+     inkscape:window-height="804"
+     inkscape:window-x="330"
+     inkscape:window-y="107"
+     inkscape:window-maximized="0">
+    <sodipodi:guide
+       orientation="1,0"
+       position="137,41"
+       id="guide5221" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata5195">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"; />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1036.3622)">
+    <g
+       transform="matrix(-1,0,0,1,57.392857,276.32649)"
+       id="g43077"
+       style="display:inline">
+      <path
+         
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+         d="m 50.549107,762.06696 6.46875,6.46875 c 0.469023,0.46901 0.375321,1.03093 0,1.40625 l 
-4.21875,4.25 c -0.359376,0.35941 -1.015625,0.39067 -1.40625,0.0312 l -0.75,-0.75 4.21875,-4.25 c 
0.375321,-0.37532 0.469023,-0.93724 0,-1.40625 l -5.71875,-5.71875 z"
+         id="path43079-5"
+         inkscape:connector-curvature="0"
+         sodipodi:nodetypes="cscccccscc" />
+      <path
+         
style="color:#000000;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;stroke-opacity:1"
+         d="m 47.254912,760.95804 6.46875,6.46875 c 0.469023,0.46901 0.375321,1.03093 0,1.40625 l 
-4.21875,4.25 c -0.359376,0.35941 -1.015625,0.39062 -1.40625,0.0312 l -6.5,-6.5 0.15625,-4.9375 c 
-4e-6,-0.17009 0.425825,-0.5625 0.59375,-0.5625 l 4.90625,-0.15625 z m -3.06093,1.61049 c -0.543655,0 
-1,0.4251 -1,0.96875 0,0.54366 0.456345,1 1,1 0.543655,0 0.96875,-0.45634 0.96875,-1 0,-0.54365 
-0.425095,-0.96875 -0.96875,-0.96875 z"
+         id="path43079"
+         inkscape:connector-curvature="0"
+         sodipodi:nodetypes="csccccccccsssss" />
+    </g>
+  </g>
+</svg>
diff --git a/src/main-window.c b/src/main-window.c
index c859a54..04376d3 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -74,6 +74,7 @@ void mw_paste_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_delete_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_insert_time_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_important_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
+void mw_show_tags_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_select_date_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_jump_to_today_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
 void mw_old_entries_activate_cb (GtkAction *action, AlmanahMainWindow *main_window);
@@ -830,6 +831,15 @@ mw_important_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
 }
 
 void
+mw_show_tags_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
+{
+       if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+               gtk_widget_show (GTK_WIDGET (main_window->priv->entry_tags_area));
+       else
+               gtk_widget_hide (GTK_WIDGET (main_window->priv->entry_tags_area));
+}
+
+void
 mw_select_date_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
 {
        AlmanahDateEntryDialog *dialog = almanah_date_entry_dialog_new ();
@@ -1294,7 +1304,15 @@ mw_setup_toolbar (AlmanahMainWindow *main_window, AlmanahApplication *applicatio
        gtk_tool_item_set_expand (tool_item, TRUE);
        gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
 
+       /* Show/hide tags: future "side pane", for photos and other elements */
+       tool_item = gtk_toggle_tool_button_new ();
+       gtk_activatable_set_related_action (GTK_ACTIVATABLE (tool_item), GTK_ACTION (gtk_builder_get_object 
(builder, "almanah_ui_show_tags")));
+       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
+
        /* Menu button with the common GNOME applications style (Nautilus, Epiphany, ...) */
+       tool_item = gtk_separator_tool_item_new ();
+       gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (tool_item), FALSE);
+       gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
        tool_item = gtk_tool_item_new ();
        button = gtk_menu_button_new ();
        popup = gtk_ui_manager_get_widget (manager, "/almanah_mw_menu_button");
diff --git a/src/widgets/entry-tags-area.c b/src/widgets/entry-tags-area.c
index b56e366..6fbe61a 100644
--- a/src/widgets/entry-tags-area.c
+++ b/src/widgets/entry-tags-area.c
@@ -44,7 +44,7 @@ static void almanah_entry_tags_area_set_property (GObject *object, guint propert
 static void almanah_entry_tags_area_finalize     (GObject *object);
 static void almanah_entry_tags_area_load_tags    (AlmanahEntryTagsArea *self);
 static void almanah_entry_tags_area_update       (AlmanahEntryTagsArea *self);
-static gint almanah_entry_tags_area_draw         (GtkWidget *widget, cairo_t *cr);
+static void almanah_entry_tags_area_show         (GtkWidget *widget);
 static void almanah_entry_tags_area_add_tag      (AlmanahEntryTagsArea *self, const gchar *tag);
 
 /* Signals */
@@ -66,7 +66,7 @@ almanah_entry_tags_area_class_init (AlmanahEntryTagsAreaClass *klass)
        gobject_class->set_property = almanah_entry_tags_area_set_property;
        gobject_class->finalize = almanah_entry_tags_area_finalize;
 
-       widget_class->draw = almanah_entry_tags_area_draw;
+       widget_class->show = almanah_entry_tags_area_show;
 
        g_object_class_install_property (gobject_class, PROP_ENTRY,
                                         g_param_spec_object ("entry",
@@ -187,21 +187,13 @@ almanah_entry_tags_area_update (AlmanahEntryTagsArea *self)
        gtk_container_foreach (GTK_CONTAINER (self), (GtkCallback) entry_tags_area_remove_foreach_cb, self);
 }
 
-static gint
-almanah_entry_tags_area_draw (GtkWidget *widget, cairo_t *cr)
+static void
+almanah_entry_tags_area_show (GtkWidget *widget)
 {
-       gint width, height;
-       GtkStyleContext *context;
-
-       /* All GtkContainer objects don't draw anything, so just draw the background using current style */
-
-       context = gtk_widget_get_style_context (widget);
-       width = gtk_widget_get_allocated_width (widget);
-       height = gtk_widget_get_allocated_height (widget);
-
-       gtk_render_background (context, cr, 0, 0, width, height);
+       AlmanahEntryTagsArea *self = ALMANAH_ENTRY_TAGS_AREA (widget);
 
-       return GTK_WIDGET_CLASS (almanah_entry_tags_area_parent_class)->draw (widget, cr);
+       gtk_widget_show (GTK_WIDGET (self->priv->tag_entry));
+       GTK_WIDGET_CLASS (almanah_entry_tags_area_parent_class)->show (widget);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]