[gthumb: 54/57] Added a share tool menu on the toolbar
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 54/57] Added a share tool menu on the toolbar
- Date: Sun, 20 Jun 2010 16:26:17 +0000 (UTC)
commit dfd0de00cb5f60c8cbdb225fa7a1eccd63999638
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Jun 20 17:24:10 2010 +0200
Added a share tool menu on the toolbar
configure.ac | 1 +
data/icons/hicolor/22x22/actions/Makefile.am | 1 +
data/icons/hicolor/22x22/actions/share.png | Bin 0 -> 945 bytes
extensions/Makefile.am | 1 +
extensions/burn_disc/burn_disc.extension.in.in | 1 +
extensions/burn_disc/callbacks.c | 5 ++
extensions/export_tools/Makefile.am | 25 ++++++++
extensions/export_tools/callbacks.c | 66 ++++++++++++++++++++
extensions/export_tools/callbacks.h | 30 +++++++++
.../export_tools/export_tools.extension.in.in | 6 ++
extensions/export_tools/main.c | 53 ++++++++++++++++
extensions/facebook/callbacks.c | 5 ++
extensions/facebook/facebook.extension.in.in | 1 +
extensions/flicker/callbacks.c | 5 ++
extensions/flicker/flicker.extension.in.in | 2 +-
extensions/list_tools/callbacks.c | 25 +-------
extensions/photobucket/callbacks.c | 5 ++
extensions/photobucket/photobucket.extension.in.in | 2 +-
extensions/picasaweb/callbacks.c | 5 ++
extensions/picasaweb/picasaweb.extension.in.in | 2 +-
extensions/webalbums/callbacks.c | 19 +++++-
extensions/webalbums/webalbums.extension.in.in | 1 +
gthumb/gth-browser-ui.h | 1 +
gthumb/gth-toggle-menu-tool-button.c | 21 ++++++
gthumb/gth-toggle-menu-tool-button.h | 4 +
25 files changed, 260 insertions(+), 27 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 24d4059..5159a36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -469,6 +469,7 @@ extensions/edit_metadata/data/ui/Makefile
extensions/exiv2_tools/Makefile
extensions/exiv2_tools/data/Makefile
extensions/exiv2_tools/data/ui/Makefile
+extensions/export_tools/Makefile
extensions/facebook/Makefile
extensions/facebook/data/Makefile
extensions/facebook/data/ui/Makefile
diff --git a/data/icons/hicolor/22x22/actions/Makefile.am b/data/icons/hicolor/22x22/actions/Makefile.am
index 2d1e03a..07db34e 100644
--- a/data/icons/hicolor/22x22/actions/Makefile.am
+++ b/data/icons/hicolor/22x22/actions/Makefile.am
@@ -11,6 +11,7 @@ icons_DATA = \
file-search.png \
histogram.png \
palette.png \
+ share.png \
tool-adjust-colors.png \
tool-crop.png \
tool-desaturate.png \
diff --git a/data/icons/hicolor/22x22/actions/share.png b/data/icons/hicolor/22x22/actions/share.png
new file mode 100644
index 0000000..b715b84
Binary files /dev/null and b/data/icons/hicolor/22x22/actions/share.png differ
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 132c8cb..96b89f6 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -8,6 +8,7 @@ SUBDIRS = \
desktop_background \
edit_metadata \
exiv2_tools \
+ export_tools \
facebook \
file_manager \
file_tools \
diff --git a/extensions/burn_disc/burn_disc.extension.in.in b/extensions/burn_disc/burn_disc.extension.in.in
index a42ca98..7ff4823 100644
--- a/extensions/burn_disc/burn_disc.extension.in.in
+++ b/extensions/burn_disc/burn_disc.extension.in.in
@@ -8,5 +8,6 @@ Icon=brasero
Category=Exporter
[Loader]
+Requires=export_tools
Type=module
File=%LIBRARY%
\ No newline at end of file
diff --git a/extensions/burn_disc/callbacks.c b/extensions/burn_disc/callbacks.c
index 5c72f24..313323c 100644
--- a/extensions/burn_disc/callbacks.c
+++ b/extensions/burn_disc/callbacks.c
@@ -43,6 +43,11 @@ static const char *ui_info =
" </menu>"
" </menu>"
" </menubar>"
+" <popup name='ExportPopup'>"
+" <placeholder name='Misc_Actions'>"
+" <menuitem action='File_Export_BurnDisc'/>"
+" </placeholder>"
+" </popup>"
"</ui>";
diff --git a/extensions/export_tools/Makefile.am b/extensions/export_tools/Makefile.am
new file mode 100644
index 0000000..a755d96
--- /dev/null
+++ b/extensions/export_tools/Makefile.am
@@ -0,0 +1,25 @@
+extensiondir = $(pkglibdir)/extensions
+extension_LTLIBRARIES = libexport_tools.la
+
+libexport_tools_la_SOURCES = \
+ callbacks.c \
+ callbacks.h \
+ main.c
+
+libexport_tools_la_CFLAGS = $(GTHUMB_CFLAGS) -I$(top_srcdir) -I$(top_builddir)/gthumb
+libexport_tools_la_LDFLAGS = $(EXTENSION_LIBTOOL_FLAGS)
+libexport_tools_la_LIBADD = $(GTHUMB_LIBS)
+libexport_tools_la_DEPENDENCIES = $(top_builddir)/gthumb/gthumb$(EXEEXT)
+
+extensioninidir = $(extensiondir)
+extensionini_in_files = export_tools.extension.in.in
+extensionini_DATA = $(extensionini_in_files:.extension.in.in=.extension)
+
+ GTHUMB_EXTENSION_IN_RULE@
+ GTHUMB_EXTENSION_RULE@
+
+EXTRA_DIST = $(extensionini_in_files)
+
+DISTCLEANFILES = $(extensionini_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/export_tools/callbacks.c b/extensions/export_tools/callbacks.c
new file mode 100644
index 0000000..191287a
--- /dev/null
+++ b/extensions/export_tools/callbacks.c
@@ -0,0 +1,66 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+
+#include <config.h>
+#include <glib/gi18n.h>
+#include <glib-object.h>
+#include <gthumb.h>
+#include "callbacks.h"
+
+
+static const char *ui_info =
+"<ui>"
+" <popup name='ExportPopup'>"
+" <placeholder name='Web_Services'/>"
+" <separator/>"
+" <placeholder name='Misc_Actions'/>"
+" </popup>"
+"</ui>";
+
+
+void
+export_tools__gth_browser_construct_cb (GthBrowser *browser)
+{
+ GError *error = NULL;
+ guint merge_id;
+ GtkToolItem *tool_item;
+
+ g_return_if_fail (GTH_IS_BROWSER (browser));
+
+ merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), ui_info, -1, &error);
+ if (merge_id == 0) {
+ g_warning ("building ui failed: %s", error->message);
+ g_clear_error (&error);
+ }
+
+ /* export tools menu button */
+
+ tool_item = g_object_new (GTH_TYPE_TOGGLE_MENU_TOOL_BUTTON, "icon-name", "share", NULL);
+ gtk_tool_button_set_label_widget (GTK_TOOL_BUTTON (tool_item), _gtk_create_toggle_menu_tool_label (_("Share")));
+ /*gtk_widget_set_tooltip_text (GTK_WIDGET (tool_item), _("Export files"));*/
+ gth_toggle_menu_tool_button_set_menu (GTH_TOGGLE_MENU_TOOL_BUTTON (tool_item),
+ gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ExportPopup"));
+ gtk_tool_item_set_is_important (GTK_TOOL_ITEM (tool_item), TRUE);
+ gtk_widget_show (GTK_WIDGET (tool_item));
+ gtk_toolbar_insert (GTK_TOOLBAR (gth_browser_get_browser_toolbar (browser)), tool_item, -1);
+}
diff --git a/extensions/export_tools/callbacks.h b/extensions/export_tools/callbacks.h
new file mode 100644
index 0000000..b275a3f
--- /dev/null
+++ b/extensions/export_tools/callbacks.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef CALLBACKS_H
+#define CALLBACKS_H
+
+#include <gthumb.h>
+
+void export_tools__gth_browser_construct_cb (GthBrowser *browser);
+
+#endif /* CALLBACKS_H */
diff --git a/extensions/export_tools/export_tools.extension.in.in b/extensions/export_tools/export_tools.extension.in.in
new file mode 100644
index 0000000..bb60f9b
--- /dev/null
+++ b/extensions/export_tools/export_tools.extension.in.in
@@ -0,0 +1,6 @@
+[Extension]
+Hidden=true
+
+[Loader]
+Type=module
+File=%LIBRARY%
diff --git a/extensions/export_tools/main.c b/extensions/export_tools/main.c
new file mode 100644
index 0000000..e678a66
--- /dev/null
+++ b/extensions/export_tools/main.c
@@ -0,0 +1,53 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+
+#include <config.h>
+#include <gtk/gtk.h>
+#include <gthumb.h>
+#include "callbacks.h"
+
+
+G_MODULE_EXPORT void
+gthumb_extension_activate (void)
+{
+ gth_hook_add_callback ("gth-browser-construct", 5, G_CALLBACK (export_tools__gth_browser_construct_cb), NULL);
+}
+
+
+G_MODULE_EXPORT void
+gthumb_extension_deactivate (void)
+{
+}
+
+
+G_MODULE_EXPORT gboolean
+gthumb_extension_is_configurable (void)
+{
+ return FALSE;
+}
+
+
+G_MODULE_EXPORT void
+gthumb_extension_configure (GtkWindow *parent)
+{
+}
diff --git a/extensions/facebook/callbacks.c b/extensions/facebook/callbacks.c
index 5f35d14..d5df7d7 100644
--- a/extensions/facebook/callbacks.c
+++ b/extensions/facebook/callbacks.c
@@ -42,6 +42,11 @@ static const char *ui_info =
" </menu>"
" </menu>"
" </menubar>"
+" <popup name='ExportPopup'>"
+" <placeholder name='Web_Services'>"
+" <menuitem action='File_Export_Facebook'/>"
+" </placeholder>"
+" </popup>"
"</ui>";
diff --git a/extensions/facebook/facebook.extension.in.in b/extensions/facebook/facebook.extension.in.in
index 8b63715..4f99239 100644
--- a/extensions/facebook/facebook.extension.in.in
+++ b/extensions/facebook/facebook.extension.in.in
@@ -9,4 +9,5 @@ Category=Exporter
[Loader]
Type=module
+Requires=export_tools
File=%LIBRARY%
diff --git a/extensions/flicker/callbacks.c b/extensions/flicker/callbacks.c
index 1daa8ca..a150d1b 100644
--- a/extensions/flicker/callbacks.c
+++ b/extensions/flicker/callbacks.c
@@ -47,6 +47,11 @@ static const char *ui_info =
" </menu>"
" </menu>"
" </menubar>"
+" <popup name='ExportPopup'>"
+" <placeholder name='Web_Services'>"
+" <menuitem action='File_Export_Flicker'/>"
+" </placeholder>"
+" </popup>"
"</ui>";
diff --git a/extensions/flicker/flicker.extension.in.in b/extensions/flicker/flicker.extension.in.in
index 17f0dea..45c8315 100644
--- a/extensions/flicker/flicker.extension.in.in
+++ b/extensions/flicker/flicker.extension.in.in
@@ -10,4 +10,4 @@ Category=Exporter
[Loader]
Type=module
File=%LIBRARY%
-Requires=importer
+Requires=importer;export_tools
diff --git a/extensions/list_tools/callbacks.c b/extensions/list_tools/callbacks.c
index 176bf68..766aa39 100644
--- a/extensions/list_tools/callbacks.c
+++ b/extensions/list_tools/callbacks.c
@@ -200,27 +200,6 @@ scripts_changed_cb (GthScriptFile *script_file,
}
-static GtkWidget *
-create_tool_label_widget (void)
-{
- GtkWidget *box1;
- GtkWidget *box2;
- GtkWidget *child;
-
- box2 = gtk_hbox_new (FALSE, 6);
- child = gtk_label_new (_("Tools"));
- gtk_box_pack_start (GTK_BOX (box2), child, FALSE, FALSE, 0);
- child = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (box2), child, FALSE, FALSE, 0);
-
- box1 = gtk_hbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, FALSE, 0);
- gtk_widget_show_all (box1);
-
- return box1;
-}
-
-
void
list_tools__gth_browser_construct_cb (GthBrowser *browser)
{
@@ -248,7 +227,7 @@ list_tools__gth_browser_construct_cb (GthBrowser *browser)
/* tools menu button */
tool_item = gth_toggle_menu_tool_button_new_from_stock (GTK_STOCK_EXECUTE);
- gtk_tool_button_set_label_widget (GTK_TOOL_BUTTON (tool_item), create_tool_label_widget ());
+ gtk_tool_button_set_label_widget (GTK_TOOL_BUTTON (tool_item), _gtk_create_toggle_menu_tool_label (_("Tools")));
gtk_widget_set_tooltip_text (GTK_WIDGET (tool_item), _("Batch tools for multiple files"));
gth_toggle_menu_tool_button_set_menu (GTH_TOGGLE_MENU_TOOL_BUTTON (tool_item),
gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup"));
@@ -257,7 +236,7 @@ list_tools__gth_browser_construct_cb (GthBrowser *browser)
gtk_toolbar_insert (GTK_TOOLBAR (gth_browser_get_browser_toolbar (browser)), tool_item, -1);
tool_item = gth_toggle_menu_tool_button_new_from_stock (GTK_STOCK_EXECUTE);
- gtk_tool_button_set_label_widget (GTK_TOOL_BUTTON (tool_item), create_tool_label_widget ());
+ gtk_tool_button_set_label_widget (GTK_TOOL_BUTTON (tool_item), _gtk_create_toggle_menu_tool_label (_("Tools")));
gtk_widget_set_tooltip_text (GTK_WIDGET (tool_item), _("Batch tools for multiple files"));
gth_toggle_menu_tool_button_set_menu (GTH_TOGGLE_MENU_TOOL_BUTTON (tool_item),
gtk_ui_manager_get_widget (gth_browser_get_ui_manager (browser), "/ListToolsPopup"));
diff --git a/extensions/photobucket/callbacks.c b/extensions/photobucket/callbacks.c
index a53d7d6..dc18385 100644
--- a/extensions/photobucket/callbacks.c
+++ b/extensions/photobucket/callbacks.c
@@ -42,6 +42,11 @@ static const char *ui_info =
" </menu>"
" </menu>"
" </menubar>"
+" <popup name='ExportPopup'>"
+" <placeholder name='Web_Services'>"
+" <menuitem action='File_Export_PhotoBucket'/>"
+" </placeholder>"
+" </popup>"
"</ui>";
diff --git a/extensions/photobucket/photobucket.extension.in.in b/extensions/photobucket/photobucket.extension.in.in
index c3201e6..96e1edf 100644
--- a/extensions/photobucket/photobucket.extension.in.in
+++ b/extensions/photobucket/photobucket.extension.in.in
@@ -10,4 +10,4 @@ Category=Exporter
[Loader]
Type=module
File=%LIBRARY%
-Requires=oauth
+Requires=oauth;export_tools
diff --git a/extensions/picasaweb/callbacks.c b/extensions/picasaweb/callbacks.c
index 41ca846..2e34be9 100644
--- a/extensions/picasaweb/callbacks.c
+++ b/extensions/picasaweb/callbacks.c
@@ -47,6 +47,11 @@ static const char *ui_info =
" </menu>"
" </menu>"
" </menubar>"
+" <popup name='ExportPopup'>"
+" <placeholder name='Web_Services'>"
+" <menuitem action='File_Export_PicasaWeb'/>"
+" </placeholder>"
+" </popup>"
"</ui>";
diff --git a/extensions/picasaweb/picasaweb.extension.in.in b/extensions/picasaweb/picasaweb.extension.in.in
index 8f5dc2d..c3970f6 100644
--- a/extensions/picasaweb/picasaweb.extension.in.in
+++ b/extensions/picasaweb/picasaweb.extension.in.in
@@ -10,4 +10,4 @@ Category=Exporter
[Loader]
Type=module
File=%LIBRARY%
-Requires=importer
+Requires=importer;export_tools
diff --git a/extensions/webalbums/callbacks.c b/extensions/webalbums/callbacks.c
index a5c4d57..e56ec75 100644
--- a/extensions/webalbums/callbacks.c
+++ b/extensions/webalbums/callbacks.c
@@ -42,17 +42,34 @@ static const char *ui_info =
" </menu>"
" </menubar>"
*/
+" <menubar name='MenuBar'>"
+" <menu name='File' action='FileMenu'>"
+" <menu name='Export' action='ExportMenu'>"
+" <placeholder name='Web_Services'>"
+" <menuitem action='Tool_CreateWebAlbum'/>"
+" </placeholder>"
+" </menu>"
+" </menu>"
+" </menubar>"
+/*
" <popup name='ListToolsPopup'>"
" <placeholder name='Tools'>"
" <menuitem name='CreateWebAlbum' action='Tool_CreateWebAlbum'/>"
" </placeholder>"
" </popup>"
+*/
+
+" <popup name='ExportPopup'>"
+" <placeholder name='Web_Services'>"
+" <menuitem action='Tool_CreateWebAlbum'/>"
+" </placeholder>"
+" </popup>"
"</ui>";
static GtkActionEntry action_entries[] = {
{ "Tool_CreateWebAlbum", "webalbums",
- N_("Create a _Web Album..."), NULL,
+ N_("_Web Album..."), NULL,
N_("Create a static web album"),
G_CALLBACK (gth_browser_activate_action_export_webalbum) },
};
diff --git a/extensions/webalbums/webalbums.extension.in.in b/extensions/webalbums/webalbums.extension.in.in
index 6f653b4..6b4c299 100644
--- a/extensions/webalbums/webalbums.extension.in.in
+++ b/extensions/webalbums/webalbums.extension.in.in
@@ -9,3 +9,4 @@ Category=Exporter
[Loader]
Type=module
File=%LIBRARY%
+Requires=export_tools
diff --git a/gthumb/gth-browser-ui.h b/gthumb/gth-browser-ui.h
index bd2a77a..4af0fac 100644
--- a/gthumb/gth-browser-ui.h
+++ b/gthumb/gth-browser-ui.h
@@ -112,6 +112,7 @@ static const char *fixed_ui_info =
" <toolbar name='ToolBar'>"
" <toolitem action='View_Stop'/>"
" <separator/>"
+" <placeholder name='Export_Actions'/>"
" <placeholder name='SourceCommands'/>"
" <separator/>"
" <placeholder name='BrowserCommands'/>"
diff --git a/gthumb/gth-toggle-menu-tool-button.c b/gthumb/gth-toggle-menu-tool-button.c
index 96c4fd9..53af2c8 100644
--- a/gthumb/gth-toggle-menu-tool-button.c
+++ b/gthumb/gth-toggle-menu-tool-button.c
@@ -398,3 +398,24 @@ gth_toggle_menu_tool_button_get_menu (GthToggleMenuToolButton *button)
return GTK_WIDGET (button->priv->menu);
}
+
+
+GtkWidget *
+_gtk_create_toggle_menu_tool_label (const char *label)
+{
+ GtkWidget *box1;
+ GtkWidget *box2;
+ GtkWidget *child;
+
+ box2 = gtk_hbox_new (FALSE, 6);
+ child = gtk_label_new (label);
+ gtk_box_pack_start (GTK_BOX (box2), child, FALSE, FALSE, 0);
+ child = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+ gtk_box_pack_start (GTK_BOX (box2), child, FALSE, FALSE, 0);
+
+ box1 = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, FALSE, 0);
+ gtk_widget_show_all (box1);
+
+ return box1;
+}
diff --git a/gthumb/gth-toggle-menu-tool-button.h b/gthumb/gth-toggle-menu-tool-button.h
index a006feb..3abf791 100644
--- a/gthumb/gth-toggle-menu-tool-button.h
+++ b/gthumb/gth-toggle-menu-tool-button.h
@@ -59,6 +59,10 @@ void gth_toggle_menu_tool_button_set_menu (GthToggleMenuToolButto
GtkWidget *menu);
GtkWidget * gth_toggle_menu_tool_button_get_menu (GthToggleMenuToolButton *button);
+/* utility */
+
+GtkWidget * _gtk_create_toggle_menu_tool_label (const char *label);
+
G_END_DECLS
#endif /* GTH_TOGGLE_MENU_TOOL_BUTTON_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]