From 4b28dd2019b62d460840d7bf29767f86ed985869 Mon Sep 17 00:00:00 2001 From: Jaap Haitsma Date: Sun, 1 Jul 2007 13:45:39 +0000 Subject: script that syncs local toolbar editor copy with the one in libegg SVN 2007-07-01 Jaap Haitsma * lib/egg/update-toolbareditor-from-libegg: script that syncs local toolbar editor copy with the one in libegg SVN * lib/egg/egg*: sync with toolbar editor in libegg. Sync obtained by running update-toolbareditor-from-libegg * lib/egg/eggintl.h: removed not needed anymore by egg-toolbareditor * lib/egg/Makefile.am: remove eggintl.h svn path=/trunk/; revision=7106 --- lib/egg/Makefile.am | 3 +- lib/egg/egg-editable-toolbar.c | 75 ++++++++++++++++++++++++++++---- lib/egg/egg-editable-toolbar.h | 6 +-- lib/egg/egg-toolbar-editor.c | 8 ++-- lib/egg/egg-toolbar-editor.h | 4 +- lib/egg/egg-toolbars-model.c | 8 ++-- lib/egg/egg-toolbars-model.h | 4 +- lib/egg/eggintl.h | 10 ----- lib/egg/eggtreemultidnd.c | 10 ++--- lib/egg/eggtreemultidnd.h | 6 +-- lib/egg/update-toolbareditor-from-libegg | 21 +++++++++ 11 files changed, 111 insertions(+), 44 deletions(-) delete mode 100644 lib/egg/eggintl.h create mode 100755 lib/egg/update-toolbareditor-from-libegg (limited to 'lib/egg') diff --git a/lib/egg/Makefile.am b/lib/egg/Makefile.am index 4d7798bb8..ba0586033 100644 --- a/lib/egg/Makefile.am +++ b/lib/egg/Makefile.am @@ -12,8 +12,7 @@ EGGHEADERS = \ noinst_HEADERS = \ $(EGGHEADERS) \ - eggmarshalers.h \ - eggintl.h + eggmarshalers.h noinst_LTLIBRARIES = libegg.la diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c index bd0ff54f3..2b26b4eaa 100644 --- a/lib/egg/egg-editable-toolbar.c +++ b/lib/egg/egg-editable-toolbar.c @@ -1,6 +1,6 @@ /* - * Copyright © 2003, 2004 Marco Pesenti Gritti - * Copyright © 2003, 2004, 2005 Christian Persch + * Copyright (C) 2003, 2004 Marco Pesenti Gritti + * Copyright (C) 2003, 2004, 2005 Christian Persch * * 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 @@ -14,7 +14,7 @@ * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ */ @@ -44,14 +44,17 @@ #include #include #include +#include #include #include static void egg_editable_toolbar_class_init (EggEditableToolbarClass *klass); static void egg_editable_toolbar_init (EggEditableToolbar *etoolbar); +static GdkPixbuf * new_separator_pixbuf (void); #define MIN_TOOLBAR_HEIGHT 20 #define EGG_ITEM_NAME "egg-item-name" +#define STOCK_DRAG_MODE "stock_drag-mode" static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, @@ -108,7 +111,7 @@ egg_editable_toolbar_get_type (void) if (G_UNLIKELY (type == 0)) { - const GTypeInfo our_info = { + static const GTypeInfo our_info = { sizeof (EggEditableToolbarClass), NULL, /* base_init */ NULL, /* base_finalize */ @@ -460,6 +463,7 @@ configure_item_cursor (GtkToolItem *item, if (priv->edit_mode > 0) { GdkCursor *cursor; + GdkPixbuf *pixbuf = NULL; cursor = gdk_cursor_new (GDK_HAND2); gdk_window_set_cursor (widget->window, cursor); @@ -467,6 +471,64 @@ configure_item_cursor (GtkToolItem *item, gtk_drag_source_set (widget, GDK_BUTTON1_MASK, dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE); + if (GTK_IS_SEPARATOR_TOOL_ITEM (item)) + { + pixbuf = new_separator_pixbuf (); + } + else + { + char *icon_name=NULL; + char *stock_id=NULL; + GtkAction *action; + char *name; + + name = g_object_get_data (G_OBJECT (widget), EGG_ITEM_NAME); + action = name ? find_action (etoolbar, name) : NULL; + + if (action) + { + g_object_get (action, + "icon-name", &icon_name, + "stock-id", &stock_id, + NULL); + } + if (icon_name) + { + GdkScreen *screen; + GtkIconTheme *icon_theme; + GtkSettings *settings; + gint width, height; + + screen = gtk_widget_get_screen (widget); + icon_theme = gtk_icon_theme_get_for_screen (screen); + settings = gtk_settings_get_for_screen (screen); + + if (!gtk_icon_size_lookup_for_settings (settings, + GTK_ICON_SIZE_LARGE_TOOLBAR, + &width, &height)) + { + width = height = 24; + } + + pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name, + MIN (width, height), 0, NULL); + } + else if (stock_id) + { + pixbuf = gtk_widget_render_icon (widget, stock_id, + GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); + } + g_free (icon_name); + g_free (stock_id); + } + + if (G_UNLIKELY (!pixbuf)) + { + return; + } + gtk_drag_source_set_icon_pixbuf (widget, pixbuf); + g_object_unref (pixbuf); + } else { @@ -531,9 +593,6 @@ action_sensitive_cb (GtkAction *action, EggEditableToolbar *etoolbar = EGG_EDITABLE_TOOLBAR (gtk_widget_get_ancestor (GTK_WIDGET (item), EGG_TYPE_EDITABLE_TOOLBAR)); - if (etoolbar == NULL) - return; - if (etoolbar->priv->edit_mode > 0) { gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE); @@ -1361,7 +1420,7 @@ egg_editable_toolbar_set_ui_manager (EggEditableToolbar *etoolbar, GtkUIManager *manager) { static const GtkActionEntry actions[] = { - { "MoveToolItem", NULL, N_("_Move on Toolbar"), NULL, + { "MoveToolItem", STOCK_DRAG_MODE, N_("_Move on Toolbar"), NULL, N_("Move the selected item on the toolbar"), G_CALLBACK (move_item_cb) }, { "RemoveToolItem", GTK_STOCK_REMOVE, N_("_Remove from Toolbar"), NULL, N_("Remove the selected item from the toolbar"), G_CALLBACK (remove_item_cb) }, diff --git a/lib/egg/egg-editable-toolbar.h b/lib/egg/egg-editable-toolbar.h index bda93a937..8a4e85e71 100644 --- a/lib/egg/egg-editable-toolbar.h +++ b/lib/egg/egg-editable-toolbar.h @@ -1,6 +1,6 @@ /* - * Copyright © 2003, 2004 Marco Pesenti Gritti - * Copyright © 2003, 2004, 2005 Christian Persch + * Copyright (C) 2003, 2004 Marco Pesenti Gritti + * Copyright (C) 2003, 2004, 2005 Christian Persch * * 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 @@ -14,7 +14,7 @@ * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ */ diff --git a/lib/egg/egg-toolbar-editor.c b/lib/egg/egg-toolbar-editor.c index 5660408a2..fdf6e3f0f 100644 --- a/lib/egg/egg-toolbar-editor.c +++ b/lib/egg/egg-toolbar-editor.c @@ -1,5 +1,5 @@ /* - * Copyright © 2003 Marco Pesenti Gritti + * Copyright (C) 2003 Marco Pesenti Gritti * * 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 @@ -13,7 +13,7 @@ * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ */ @@ -22,7 +22,6 @@ #include "egg-toolbar-editor.h" #include "egg-editable-toolbar.h" -#include "eggintl.h" #include #include @@ -35,6 +34,7 @@ #include #include #include +#include static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, @@ -78,7 +78,7 @@ egg_toolbar_editor_get_type (void) if (G_UNLIKELY (type == 0)) { - const GTypeInfo our_info = { + static const GTypeInfo our_info = { sizeof (EggToolbarEditorClass), NULL, /* base_init */ NULL, /* base_finalize */ diff --git a/lib/egg/egg-toolbar-editor.h b/lib/egg/egg-toolbar-editor.h index 083be215f..e29e5482b 100644 --- a/lib/egg/egg-toolbar-editor.h +++ b/lib/egg/egg-toolbar-editor.h @@ -1,5 +1,5 @@ /* - * Copyright © 2003 Marco Pesenti Gritti + * Copyright (C) 2003 Marco Pesenti Gritti * * 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 @@ -13,7 +13,7 @@ * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef EGG_TOOLBAR_EDITOR_H diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c index 16091f08c..f0a5b0fa0 100644 --- a/lib/egg/egg-toolbars-model.c +++ b/lib/egg/egg-toolbars-model.c @@ -1,6 +1,6 @@ /* - * Copyright © 2002-2004 Marco Pesenti Gritti - * Copyright © 2004 Christian Persch + * Copyright (C) 2002-2004 Marco Pesenti Gritti + * Copyright (C) 2004 Christian Persch * * 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 @@ -14,7 +14,7 @@ * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ */ @@ -75,7 +75,7 @@ egg_toolbars_model_get_type (void) if (G_UNLIKELY (type == 0)) { - const GTypeInfo our_info = { + static const GTypeInfo our_info = { sizeof (EggToolbarsModelClass), NULL, /* base_init */ NULL, /* base_finalize */ diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h index fa6a4a2e1..6961ee4ec 100644 --- a/lib/egg/egg-toolbars-model.h +++ b/lib/egg/egg-toolbars-model.h @@ -1,5 +1,5 @@ /* - * Copyright © 2003-2004 Marco Pesenti Gritti + * Copyright (C) 2003-2004 Marco Pesenti Gritti * * 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 @@ -13,7 +13,7 @@ * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ */ diff --git a/lib/egg/eggintl.h b/lib/egg/eggintl.h deleted file mode 100644 index 2b144c670..000000000 --- a/lib/egg/eggintl.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __EGG_INTL_H__ -#define __EGG_INTL_H__ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -#endif /* __EGG_INTL_H__ */ diff --git a/lib/egg/eggtreemultidnd.c b/lib/egg/eggtreemultidnd.c index f849b10f7..3a7da919c 100644 --- a/lib/egg/eggtreemultidnd.c +++ b/lib/egg/eggtreemultidnd.c @@ -1,5 +1,5 @@ /* eggtreemultidnd.c - * Copyright © 2001 Red Hat, Inc. + * Copyright (C) 2001 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -13,12 +13,10 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ -#include - #include #include #include @@ -61,7 +59,7 @@ egg_tree_multi_drag_source_get_type (void) if (!our_type) { - const GTypeInfo our_info = + static const GTypeInfo our_info = { sizeof (EggTreeMultiDragSourceIface), /* class_size */ NULL, /* base_init */ diff --git a/lib/egg/eggtreemultidnd.h b/lib/egg/eggtreemultidnd.h index 14df5f18f..810d48ea7 100644 --- a/lib/egg/eggtreemultidnd.h +++ b/lib/egg/eggtreemultidnd.h @@ -1,5 +1,5 @@ /* eggtreednd.h - * Copyright © 2001 Red Hat, Inc. + * Copyright (C) 2001 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -13,8 +13,8 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. */ #ifndef __EGG_TREE_MULTI_DND_H__ diff --git a/lib/egg/update-toolbareditor-from-libegg b/lib/egg/update-toolbareditor-from-libegg new file mode 100755 index 000000000..fe56a2fc2 --- /dev/null +++ b/lib/egg/update-toolbareditor-from-libegg @@ -0,0 +1,21 @@ +#!/bin/sh +# Get latest toolbar editor from libegg +# Developers using the toolbar editor in their projects can use this script to +# fetch the latest toolbar editor from libegg +echo "Obtaining latest version of toolbar editor from libegg" + +FILES="egg-editable-toolbar.c \ + egg-toolbars-model.c \ + egg-toolbar-editor.c \ + eggtreemultidnd.c \ + egg-editable-toolbar.h \ + egg-toolbars-model.h \ + egg-toolbar-editor.h \ + eggtreemultidnd.h \ + eggmarshalers.list" + +for FILE in $FILES +do + svn export http://svn.gnome.org/svn/libegg/trunk/libegg/toolbareditor/$FILE +done + -- cgit v1.2.3