[gthumb] added the slideshow action and buttons



commit 7449de3ac0520093fe93ef6d53841db19779ee38
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Oct 17 11:14:29 2013 +0200

    added the slideshow action and buttons

 data/icons/hicolor/scalable/actions/Makefile.am    |    3 +-
 .../actions/view-presentation-symbolic.svg         |  163 ++++++++++++++++++++
 extensions/slideshow/actions.c                     |    9 +
 extensions/slideshow/actions.h                     |    1 +
 extensions/slideshow/callbacks.c                   |   23 +++
 gthumb/glib-utils.h                                |    1 +
 gthumb/gth-browser-actions-callbacks.h             |   11 +-
 7 files changed, 204 insertions(+), 7 deletions(-)
---
diff --git a/data/icons/hicolor/scalable/actions/Makefile.am b/data/icons/hicolor/scalable/actions/Makefile.am
index 8a9feb2..807533f 100644
--- a/data/icons/hicolor/scalable/actions/Makefile.am
+++ b/data/icons/hicolor/scalable/actions/Makefile.am
@@ -14,7 +14,8 @@ icons_DATA =                          \
        slideshow-pause.svg             \
        tag.svg                         \
        tool-adjust-contrast.svg        \
-       tool-sharpen.svg
+       tool-sharpen.svg                \
+       view-presentation-symbolic.svg
 
 EXTRA_DIST = $(icons_DATA)
 
diff --git a/data/icons/hicolor/scalable/actions/view-presentation-symbolic.svg 
b/data/icons/hicolor/scalable/actions/view-presentation-symbolic.svg
new file mode 100644
index 0000000..097d640
--- /dev/null
+++ b/data/icons/hicolor/scalable/actions/view-presentation-symbolic.svg
@@ -0,0 +1,163 @@
+<?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="svg2"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="view-presentation-symbolic.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#555753"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="1"
+     inkscape:pageshadow="2"
+     inkscape:zoom="32"
+     inkscape:cx="5.3581155"
+     inkscape:cy="9.5270697"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:snap-grids="false"
+     inkscape:window-width="1483"
+     inkscape:window-height="933"
+     inkscape:window-x="380"
+     inkscape:window-y="132"
+     inkscape:window-maximized="0"
+     showborder="true"
+     fit-margin-top="0"
+     fit-margin-right="0"
+     fit-margin-left="0"
+     fit-margin-bottom="0"
+     showguides="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid7044"
+       empspacing="8"
+       visible="true"
+       enabled="true"
+       snapvisiblegridlinesonly="true"
+       originx="-31.97559px"
+       originy="-816.00002px" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <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="Livello 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-31.97559,-220.36218)">
+    <path
+       inkscape:export-ydpi="89"
+       inkscape:export-xdpi="89"
+       
inkscape:export-filename="/home/paolo/workspace/gthumb/data/icons/hicolor/16x16/actions/view-presentation-symbolic.png"
+       sodipodi:nodetypes="cccccccccccccccc"
+       inkscape:connector-curvature="0"
+       id="path2997"
+       d="m 34.541788,222.36336 -0.5,0.5 0,7.52344 c 0.01241,0.99754 1.010169,2.02365 1.994369,2.00781 l 
7.990085,0 c 1.22279,-0.007 2.061362,-0.72154 2.046796,-2.0026 l 0,-7.52865 -0.5,-0.5 z m 0.5,1 10.03125,0 
0,7.02889 c 0.02801,0.53221 -0.244067,1.00993 -1.038563,1.00236 l -7.98727,0 c -0.547572,0 -1.025146,-0.51078 
-1.005417,-0.99981 z"
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
 />
+    <path
+       sodipodi:nodetypes="cccsccc"
+       inkscape:export-ydpi="89"
+       inkscape:export-xdpi="89"
+       
inkscape:export-filename="/home/paolo/workspace/gthumb/data/icons/hicolor/16x16/actions/view-presentation-symbolic.png"
+       inkscape:connector-curvature="0"
+       id="path2999"
+       d="m 33.034131,222.38623 c 0.0036,0.44903 0.490704,1.02938 1.001458,1.00553 l 12.14143,0 c 
0.470758,0.006 0.86089,-0.50027 0.86089,-0.97242 0,-0.47215 -0.395656,-1.04197 -0.866414,-1.03586 l 
-12.135906,0.0166 c -0.543543,-0.003 -0.999578,0.47629 -1.001458,0.98615 z"
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
 />
+    <path
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
+       d="m 40.140409,233.04487 c -0.237096,0.79317 -1.505881,2.0046 -3.056843,2.76451 -0.803949,-0.0413 
-0.832493,-0.57613 -0.676565,-0.83327 1.369137,-0.6708 2.409257,-1.34805 2.599709,-1.9818 l 1.133699,0.0515 z"
+       id="path3001"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccccc" />
+    <path
+       id="path3003"
+       d="m 39.029302,232.07845 2.033338,0 0,1.30935 -2.033338,0 z"
+       style="fill:#bebebe;fill-opacity:1;stroke:none"
+       inkscape:connector-curvature="0" />
+    <path
+       sodipodi:nodetypes="cccccc"
+       inkscape:connector-curvature="0"
+       id="path3005"
+       d="m 39.926047,233.04487 c 0.237096,0.79317 1.505881,2.0046 3.056843,2.76451 0.803949,-0.0413 
0.832493,-0.57613 0.676565,-0.83327 -1.369137,-0.6708 -2.409257,-1.34805 -2.599709,-1.9818 l -1.133699,0.0515 
z"
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
 />
+    <path
+       inkscape:connector-curvature="0"
+       style="opacity:0.98999999;fill:#bebebe;fill-opacity:1;stroke:none"
+       inkscape:transform-center-x="-2.3062429"
+       inkscape:transform-center-y="1.4481209"
+       d="m 36.035402,214.22559 0.01755,-5.5052 0.01755,-5.50521 4.758872,2.7678 4.758873,2.76781 
-4.776425,2.73741 z"
+       id="path3009" />
+    <path
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
+       d="m 13.59375,203.95269 -0.5,0.5 0,7.52344 c 0.01241,0.99754 1.010169,2.02365 1.994369,2.00781 l 
7.990085,0 c 1.22279,-0.007 2.061362,-0.72154 2.046796,-2.0026 l 0,-7.52865 -0.5,-0.5 z m 0.5,1 10.03125,0 
0,7.02889 c 0.02801,0.53221 -0.244067,1.00993 -1.038563,1.00236 l -7.98727,0 c -0.547572,0 -1.025146,-0.51078 
-1.005417,-0.99981 z"
+       id="path3790"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccccccccccccccc"
+       
inkscape:export-filename="/home/paolo/workspace/gthumb/data/icons/hicolor/16x16/actions/view-presentation-symbolic.png"
+       inkscape:export-xdpi="89"
+       inkscape:export-ydpi="89" />
+    <path
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
+       d="m 12.086093,203.97556 c 0.0036,0.44903 0.490704,1.02938 1.001458,1.00553 l 12.14143,0 c 
0.470758,0.006 0.86089,-0.50027 0.86089,-0.97242 0,-0.47215 -0.395656,-1.04197 -0.866414,-1.03586 l 
-12.135906,0.0166 c -0.543543,-0.003 -0.999578,0.47629 -1.001458,0.98615 z"
+       id="path3792"
+       inkscape:connector-curvature="0"
+       
inkscape:export-filename="/home/paolo/workspace/gthumb/data/icons/hicolor/16x16/actions/view-presentation-symbolic.png"
+       inkscape:export-xdpi="89"
+       inkscape:export-ydpi="89"
+       sodipodi:nodetypes="cccsccc" />
+    <path
+       sodipodi:nodetypes="cccccc"
+       inkscape:connector-curvature="0"
+       id="path3794"
+       d="m 19.192371,214.6342 c -0.237096,0.79317 -1.505881,2.0046 -3.056843,2.76451 -0.803949,-0.0413 
-0.832493,-0.57613 -0.676565,-0.83327 1.369137,-0.6708 2.409257,-1.34805 2.599709,-1.9818 l 1.133699,0.0515 z"
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
 />
+    <path
+       inkscape:connector-curvature="0"
+       style="fill:#bebebe;fill-opacity:1;stroke:none"
+       d="m 18.081264,213.66778 2.033338,0 0,1.30935 -2.033338,0 z"
+       id="path3796" />
+    <path
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
+       d="m 18.978009,214.6342 c 0.237096,0.79317 1.505881,2.0046 3.056843,2.76451 0.803949,-0.0413 
0.832493,-0.57613 0.676565,-0.83327 -1.369137,-0.6708 -2.409257,-1.34805 -2.599709,-1.9818 l -1.133699,0.0515 
z"
+       id="path3798"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccccc" />
+    <path
+       
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;opacity:0.75;color:#000000;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:1px;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
+       d="m 17.6875,206.39019 a 0.50024408,0.50024408 0 1 0 -0.25,0.96875 l 2.78125,1.53125 -2.84375,1.53125 
a 0.50005,0.50005 0 1 0 0.46875,0.875 L 21.5,209.32769 a 0.50005,0.50005 0 0 0 0,-0.875 l -3.5625,-1.96875 a 
0.50005,0.50005 0 0 0 -0.25,-0.0937 z"
+       id="path3800"
+       inkscape:connector-curvature="0" />
+    <rect
+       style="opacity:0.35;fill:#bebebe;fill-opacity:1;stroke:none"
+       id="rect3804"
+       width="8.03125"
+       height="5.96875"
+       x="4.03125"
+       y="4.0625"
+       transform="translate(31.97559,220.36218)" />
+  </g>
+</svg>
diff --git a/extensions/slideshow/actions.c b/extensions/slideshow/actions.c
index 95c0477..673db97 100644
--- a/extensions/slideshow/actions.c
+++ b/extensions/slideshow/actions.c
@@ -138,3 +138,12 @@ gth_browser_activate_action_view_slideshow (GtkAction  *action,
        _g_object_list_unref (file_list);
        _gtk_tree_path_list_free (items);
 }
+
+
+void
+gth_browser_activate_slideshow (GSimpleAction *action,
+                               GVariant      *parameter,
+                               gpointer       user_data)
+{
+       gth_browser_activate_action_view_slideshow (NULL, GTH_BROWSER (user_data));
+}
diff --git a/extensions/slideshow/actions.h b/extensions/slideshow/actions.h
index b4caf85..da36076 100644
--- a/extensions/slideshow/actions.h
+++ b/extensions/slideshow/actions.h
@@ -27,5 +27,6 @@
 #define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
 
 DEFINE_ACTION(gth_browser_activate_action_view_slideshow)
+DEF_ACTION_CALLBACK (gth_browser_activate_slideshow)
 
 #endif /* ACTIONS_H */
diff --git a/extensions/slideshow/callbacks.c b/extensions/slideshow/callbacks.c
index 6b5defc..b6c9385 100644
--- a/extensions/slideshow/callbacks.c
+++ b/extensions/slideshow/callbacks.c
@@ -33,6 +33,11 @@
 #define BROWSER_DATA_KEY "slideshow-browser-data"
 
 
+static const GActionEntry actions[] = {
+       { "slideshow", gth_browser_activate_slideshow }
+};
+
+
 static const char *ui_info =
 "<ui>"
 "  <menubar name='MenuBar'>"
@@ -96,6 +101,22 @@ ss__gth_browser_construct_cb (GthBrowser *browser)
                g_error_free (error);
        }
 
+       g_action_map_add_action_entries (G_ACTION_MAP (browser), actions, G_N_ELEMENTS (actions), browser);
+
+       {
+               GtkWidget *button;
+
+               button = _gtk_image_button_new_for_header_bar ("view-presentation-symbolic");
+               gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.slideshow");
+               gtk_widget_show (button);
+               gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, 
GTH_BROWSER_HEADER_SECTION_BROWSER_VIEW)), button, FALSE, FALSE, 0);
+
+               button = _gtk_image_button_new_for_header_bar ("view-presentation-symbolic");
+               gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.slideshow");
+               gtk_widget_show (button);
+               gtk_box_pack_start (GTK_BOX (gth_browser_get_headerbar_section (browser, 
GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW)), button, FALSE, FALSE, 0);
+       }
+
        g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) 
browser_data_free);
 }
 
@@ -125,6 +146,8 @@ ss__gth_browser_update_sensitivity_cb (GthBrowser *browser)
        file_store = gth_file_view_get_model (GTH_FILE_VIEW (gth_browser_get_file_list_view (browser)));
        sensitive = (gth_file_store_n_visibles (GTH_FILE_STORE (file_store)) > 0);
        set_action_sensitive (data, "View_Slideshow", sensitive);
+
+       g_object_set (g_action_map_lookup_action (G_ACTION_MAP (browser), "slideshow"), "enabled", sensitive, 
NULL);
 }
 
 
diff --git a/gthumb/glib-utils.h b/gthumb/glib-utils.h
index b0598ac..0df9042 100644
--- a/gthumb/glib-utils.h
+++ b/gthumb/glib-utils.h
@@ -76,6 +76,7 @@ G_BEGIN_DECLS
 #endif
 
 #define DEFAULT_STRFTIME_FORMAT "%Y-%m-%d--%H.%M.%S"
+#define DEF_ACTION_CALLBACK(x) void x (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 
 /* signals */
 
diff --git a/gthumb/gth-browser-actions-callbacks.h b/gthumb/gth-browser-actions-callbacks.h
index 57df734..948b754 100644
--- a/gthumb/gth-browser-actions-callbacks.h
+++ b/gthumb/gth-browser-actions-callbacks.h
@@ -25,7 +25,6 @@
 #include <gtk/gtk.h>
 
 #define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
-#define ACTION_CALLBACK(x) void x (GSimpleAction *action, GVariant *parameter, gpointer user_data);
 
 DEFINE_ACTION(gth_browser_activate_action_bookmarks_add)
 DEFINE_ACTION(gth_browser_activate_action_bookmarks_edit)
@@ -69,10 +68,10 @@ DEFINE_ACTION(gth_browser_activate_action_browser_tools)
 DEFINE_ACTION(gth_browser_activate_action_viewer_tools)
 DEFINE_ACTION(gth_browser_activate_action_view_shrink_wrap)
 
-ACTION_CALLBACK (gth_browser_activate_save)
-ACTION_CALLBACK (gth_browser_activate_save_as)
-ACTION_CALLBACK (gth_browser_activate_revert_to_saved)
-ACTION_CALLBACK (gth_browser_activate_close)
-ACTION_CALLBACK (gth_browser_activate_quit)
+DEF_ACTION_CALLBACK (gth_browser_activate_save)
+DEF_ACTION_CALLBACK (gth_browser_activate_save_as)
+DEF_ACTION_CALLBACK (gth_browser_activate_revert_to_saved)
+DEF_ACTION_CALLBACK (gth_browser_activate_close)
+DEF_ACTION_CALLBACK (gth_browser_activate_quit)
 
 #endif /* GTH_BROWSER_ACTIONS_CALLBACK_H */


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