[gimp] plug-ins: port help-browser to icon names
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: port help-browser to icon names
- Date: Sun, 11 May 2014 22:19:59 +0000 (UTC)
commit a54b1ca12ce005d1871f1f8c8b59d62500e577dc
Author: Michael Natterer <mitch gimp org>
Date: Mon May 12 00:17:57 2014 +0200
plug-ins: port help-browser to icon names
plug-ins/help-browser/dialog.c | 48 ++++++++++++-------------
plug-ins/help-browser/gimpthrobber.c | 54 ++++++++++++++--------------
plug-ins/help-browser/gimpthrobber.h | 8 ++--
plug-ins/help-browser/gimpthrobberaction.c | 14 ++++----
plug-ins/help-browser/gimpthrobberaction.h | 2 +-
5 files changed, 62 insertions(+), 64 deletions(-)
---
diff --git a/plug-ins/help-browser/dialog.c b/plug-ins/help-browser/dialog.c
index 63f3f7f..42447ae 100644
--- a/plug-ins/help-browser/dialog.c
+++ b/plug-ins/help-browser/dialog.c
@@ -335,18 +335,16 @@ browser_dialog_load (const gchar *uri)
static void
window_set_icons (GtkWidget *window)
{
- const GtkIconSize sizes[] = { GTK_ICON_SIZE_MENU,
- GTK_ICON_SIZE_BUTTON,
- GTK_ICON_SIZE_DND,
- GTK_ICON_SIZE_DIALOG };
- GList *list = NULL;
- gint i;
+ GtkIconTheme *theme = gtk_icon_theme_get_default ();
+ gint sizes[] = { 16, 24, 32, 64 };
+ GList *list = NULL;
+ gint i;
for (i = 0; i < G_N_ELEMENTS (sizes); i++)
list = g_list_prepend (list,
- gtk_widget_render_icon (window,
- GIMP_STOCK_USER_MANUAL,
- sizes[i], NULL));
+ gtk_icon_theme_load_icon (theme,
+ GIMP_STOCK_USER_MANUAL,
+ sizes[i], 0, NULL));
gtk_window_set_icon_list (GTK_WINDOW (window), list);
@@ -576,53 +574,53 @@ ui_manager_new (GtkWidget *window)
static const GtkActionEntry actions[] =
{
{
- "back", GTK_STOCK_GO_BACK,
+ "back", "go-previous",
NULL, "<alt>Left", N_("Go back one page"),
G_CALLBACK (back_callback)
},
{
- "forward", GTK_STOCK_GO_FORWARD,
+ "forward", "go-next",
NULL, "<alt>Right", N_("Go forward one page"),
G_CALLBACK (forward_callback)
},
{
- "reload", GTK_STOCK_REFRESH,
+ "reload", "view-refresh",
N_("_Reload"), "<control>R", N_("Reload current page"),
G_CALLBACK (reload_callback)
},
{
- "stop", GTK_STOCK_CANCEL,
+ "stop", "process-stop",
N_("_Stop"), "Escape", N_("Stop loading this page"),
G_CALLBACK (stop_callback)
},
{
- "home", GTK_STOCK_HOME,
+ "home", "go-home",
NULL, "<alt>Home", N_("Go to the index page"),
G_CALLBACK (home_callback)
},
{
- "copy-location", GTK_STOCK_COPY,
+ "copy-location", "edit-copy",
N_("C_opy location"), "",
N_("Copy the location of this page to the clipboard"),
G_CALLBACK (copy_location_callback)
},
{
- "copy-selection", GTK_STOCK_COPY,
+ "copy-selection", "edit-copy",
NULL, "<control>C", NULL,
G_CALLBACK (copy_selection_callback)
},
{
- "zoom-in", GTK_STOCK_ZOOM_IN,
+ "zoom-in", "zoom-in",
NULL, "<control>plus", NULL,
G_CALLBACK (zoom_in_callback)
},
{
- "zoom-out", GTK_STOCK_ZOOM_OUT,
+ "zoom-out", "zoom-out",
NULL, "<control>minus", NULL,
G_CALLBACK (zoom_out_callback)
},
{
- "find", GTK_STOCK_FIND,
+ "find", "edit-find",
NULL, "<control>F", N_("Find text in current page"),
G_CALLBACK (find_callback)
},
@@ -632,12 +630,12 @@ ui_manager_new (GtkWidget *window)
G_CALLBACK (find_again_callback)
},
{
- "close", GTK_STOCK_CLOSE,
+ "close", "window-close",
NULL, "<control>W", NULL,
G_CALLBACK (close_callback)
},
{
- "quit", GTK_STOCK_QUIT,
+ "quit", "application-exit",
NULL, "<control>Q", NULL,
G_CALLBACK (close_callback)
}
@@ -1189,8 +1187,8 @@ build_searchbar (void)
button = gtk_button_new_with_mnemonic (C_("search", "_Previous"));
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_image (GTK_BUTTON (button),
- gtk_image_new_from_stock (GTK_STOCK_GO_BACK,
- GTK_ICON_SIZE_BUTTON));
+ gtk_image_new_from_icon_name ("go-previous",
+ GTK_ICON_SIZE_BUTTON));
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
@@ -1201,8 +1199,8 @@ build_searchbar (void)
button = gtk_button_new_with_mnemonic (C_("search", "_Next"));
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_image (GTK_BUTTON (button),
- gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,
- GTK_ICON_SIZE_BUTTON));
+ gtk_image_new_from_icon_name ("go-next",
+ GTK_ICON_SIZE_BUTTON));
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
diff --git a/plug-ins/help-browser/gimpthrobber.c b/plug-ins/help-browser/gimpthrobber.c
index a7844bc..dec84ca 100644
--- a/plug-ins/help-browser/gimpthrobber.c
+++ b/plug-ins/help-browser/gimpthrobber.c
@@ -34,7 +34,7 @@ enum
enum
{
PROP_0,
- PROP_STOCK_ID,
+ PROP_ICON_NAME,
PROP_IMAGE
};
@@ -72,7 +72,7 @@ struct _GimpThrobberPrivate
{
GtkWidget *button;
GtkWidget *image;
- gchar *stock_id;
+ gchar *icon_name;
};
@@ -120,8 +120,8 @@ gimp_throbber_class_init (GimpThrobberClass *klass)
tool_item_class->toolbar_reconfigured = gimp_throbber_toolbar_reconfigured;
g_object_class_install_property (object_class,
- PROP_STOCK_ID,
- g_param_spec_string ("stock-id", NULL, NULL,
+ PROP_ICON_NAME,
+ g_param_spec_string ("icon-name", NULL, NULL,
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
@@ -184,13 +184,13 @@ gimp_throbber_construct_contents (GtkToolItem *tool_item)
if (style == GTK_TOOLBAR_TEXT)
{
- image = gtk_image_new_from_stock (button->priv->stock_id,
- GTK_ICON_SIZE_MENU);
+ image = gtk_image_new_from_icon_name (button->priv->icon_name,
+ GTK_ICON_SIZE_MENU);
}
else if (style == GTK_TOOLBAR_ICONS)
{
- image = gtk_image_new_from_stock (button->priv->stock_id,
- GTK_ICON_SIZE_LARGE_TOOLBAR);
+ image = gtk_image_new_from_icon_name (button->priv->icon_name,
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
}
else if (button->priv->image)
{
@@ -198,8 +198,8 @@ gimp_throbber_construct_contents (GtkToolItem *tool_item)
}
else
{
- image = gtk_image_new_from_stock (button->priv->stock_id,
- GTK_ICON_SIZE_DND);
+ image = gtk_image_new_from_icon_name (button->priv->icon_name,
+ GTK_ICON_SIZE_DND);
}
gtk_container_add (GTK_CONTAINER (button->priv->button), image);
@@ -221,8 +221,8 @@ gimp_throbber_set_property (GObject *object,
switch (prop_id)
{
- case PROP_STOCK_ID:
- gimp_throbber_set_stock_id (button, g_value_get_string (value));
+ case PROP_ICON_NAME:
+ gimp_throbber_set_icon_name (button, g_value_get_string (value));
break;
case PROP_IMAGE:
@@ -245,8 +245,8 @@ gimp_throbber_get_property (GObject *object,
switch (prop_id)
{
- case PROP_STOCK_ID:
- g_value_set_string (value, button->priv->stock_id);
+ case PROP_ICON_NAME:
+ g_value_set_string (value, button->priv->icon_name);
break;
case PROP_IMAGE:
@@ -264,8 +264,8 @@ gimp_throbber_finalize (GObject *object)
{
GimpThrobber *button = GIMP_THROBBER (object);
- if (button->priv->stock_id)
- g_free (button->priv->stock_id);
+ if (button->priv->icon_name)
+ g_free (button->priv->icon_name);
if (button->priv->image)
g_object_unref (button->priv->image);
@@ -295,37 +295,37 @@ gimp_throbber_toolbar_reconfigured (GtkToolItem *tool_item)
}
GtkToolItem *
-gimp_throbber_new (const gchar *stock_id)
+gimp_throbber_new (const gchar *icon_name)
{
return g_object_new (GIMP_TYPE_THROBBER,
- "stock-id", stock_id,
+ "icon-name", icon_name,
NULL);
}
void
-gimp_throbber_set_stock_id (GimpThrobber *button,
- const gchar *stock_id)
+gimp_throbber_set_icon_name (GimpThrobber *button,
+ const gchar *icon_name)
{
- gchar *old_stock_id;
+ gchar *old_icon_name;
g_return_if_fail (GIMP_IS_THROBBER (button));
- old_stock_id = button->priv->stock_id;
+ old_icon_name = button->priv->icon_name;
- button->priv->stock_id = g_strdup (stock_id);
+ button->priv->icon_name = g_strdup (icon_name);
gimp_throbber_construct_contents (GTK_TOOL_ITEM (button));
- g_object_notify (G_OBJECT (button), "stock-id");
+ g_object_notify (G_OBJECT (button), "icon-name");
- g_free (old_stock_id);
+ g_free (old_icon_name);
}
const gchar *
-gimp_throbber_get_stock_id (GimpThrobber *button)
+gimp_throbber_get_icon_name (GimpThrobber *button)
{
g_return_val_if_fail (GIMP_IS_THROBBER (button), NULL);
- return button->priv->stock_id;
+ return button->priv->icon_name;
}
void
diff --git a/plug-ins/help-browser/gimpthrobber.h b/plug-ins/help-browser/gimpthrobber.h
index 1abe839..3a154e0 100644
--- a/plug-ins/help-browser/gimpthrobber.h
+++ b/plug-ins/help-browser/gimpthrobber.h
@@ -54,10 +54,10 @@ struct _GimpThrobberClass
GType gimp_throbber_get_type (void) G_GNUC_CONST;
-GtkToolItem * gimp_throbber_new (const gchar *stock_id);
-void gimp_throbber_set_stock_id (GimpThrobber *button,
- const gchar *stock_id);
-const gchar * gimp_throbber_get_stock_id (GimpThrobber *button);
+GtkToolItem * gimp_throbber_new (const gchar *icon_name);
+void gimp_throbber_set_icon_name (GimpThrobber *button,
+ const gchar *icon_name);
+const gchar * gimp_throbber_get_icon_name (GimpThrobber *button);
void gimp_throbber_set_image (GimpThrobber *button,
GtkWidget *image);
GtkWidget * gimp_throbber_get_image (GimpThrobber *button);
diff --git a/plug-ins/help-browser/gimpthrobberaction.c b/plug-ins/help-browser/gimpthrobberaction.c
index 0b9d00b..2adb17a 100644
--- a/plug-ins/help-browser/gimpthrobberaction.c
+++ b/plug-ins/help-browser/gimpthrobberaction.c
@@ -90,10 +90,10 @@ gimp_throbber_action_connect_proxy (GtkAction *action,
GParamSpec *pspec;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (action),
- "stock-id");
+ "icon-name");
gimp_throbber_action_sync_property (action, pspec, proxy);
- g_signal_connect_object (action, "notify::stock-id",
+ g_signal_connect_object (action, "notify::icon-name",
G_CALLBACK (gimp_throbber_action_sync_property),
proxy, 0);
@@ -122,12 +122,12 @@ GtkAction *
gimp_throbber_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
- const gchar *stock_id)
+ const gchar *icon_name)
{
return g_object_new (GIMP_TYPE_THROBBER_ACTION,
- "name", name,
- "label", label,
- "tooltip", tooltip,
- "stock-id", stock_id,
+ "name", name,
+ "label", label,
+ "tooltip", tooltip,
+ "icon-name", icon_name,
NULL);
}
diff --git a/plug-ins/help-browser/gimpthrobberaction.h b/plug-ins/help-browser/gimpthrobberaction.h
index 2e6a9a4..dcdef05 100644
--- a/plug-ins/help-browser/gimpthrobberaction.h
+++ b/plug-ins/help-browser/gimpthrobberaction.h
@@ -40,7 +40,7 @@ GType gimp_throbber_action_get_type (void) G_GNUC_CONST;
GtkAction * gimp_throbber_action_new (const gchar *name,
const gchar *label,
const gchar *tooltip,
- const gchar *stock_id);
+ const gchar *icon_name);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]