summaryrefslogtreecommitdiff
path: root/plugins/thunar-uca
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2009-12-15 12:12:19 +0100
committerNick Schermer <nick@xfce.org>2009-12-20 12:31:19 +0100
commit19383d0e0da7293931ae4420fca6cecbe5938259 (patch)
tree625c3e02a1b3e747b3d11f499a94f73d9489502f /plugins/thunar-uca
parent7136ce5430e61863bb7ab8275544c85cadb8ae40 (diff)
downloadthunar-19383d0e0da7293931ae4420fca6cecbe5938259.tar.gz
Use the icon-name property for GtkAction's in uca.
Since GTK+ 2.10 there is an icon-name property for GtkActions. Use this property instead of creating stock-id's.
Diffstat (limited to 'plugins/thunar-uca')
-rw-r--r--plugins/thunar-uca/thunar-uca-chooser.c2
-rw-r--r--plugins/thunar-uca/thunar-uca-model.c32
-rw-r--r--plugins/thunar-uca/thunar-uca-model.h1
-rw-r--r--plugins/thunar-uca/thunar-uca-provider.c9
4 files changed, 6 insertions, 38 deletions
diff --git a/plugins/thunar-uca/thunar-uca-chooser.c b/plugins/thunar-uca/thunar-uca-chooser.c
index f9f40f8c..f58799d6 100644
--- a/plugins/thunar-uca/thunar-uca-chooser.c
+++ b/plugins/thunar-uca/thunar-uca-chooser.c
@@ -159,7 +159,7 @@ thunar_uca_chooser_init (ThunarUcaChooser *uca_chooser)
renderer = g_object_new (GTK_TYPE_CELL_RENDERER_PIXBUF, "stock-size", GTK_ICON_SIZE_DND, "xpad", 2, "ypad", 2, NULL);
gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_column_set_attributes (column, renderer, "stock-id", THUNAR_UCA_MODEL_COLUMN_STOCK_ID, NULL);
+ gtk_tree_view_column_set_attributes (column, renderer, "icon-name", THUNAR_UCA_MODEL_COLUMN_ICON, NULL);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_column_pack_start (column, renderer, TRUE);
diff --git a/plugins/thunar-uca/thunar-uca-model.c b/plugins/thunar-uca/thunar-uca-model.c
index 822c8a25..fefb1017 100644
--- a/plugins/thunar-uca/thunar-uca-model.c
+++ b/plugins/thunar-uca/thunar-uca-model.c
@@ -165,7 +165,6 @@ struct _ThunarUcaModelItem
ThunarUcaTypes types;
/* derived attributes */
- gchar *stock_id;
gboolean multiple_selection : 1;
};
@@ -330,9 +329,6 @@ thunar_uca_model_get_column_type (GtkTreeModel *tree_model,
case THUNAR_UCA_MODEL_COLUMN_TYPES:
return G_TYPE_UINT;
- case THUNAR_UCA_MODEL_COLUMN_STOCK_ID:
- return G_TYPE_STRING;
-
case THUNAR_UCA_MODEL_COLUMN_STOCK_LABEL:
return G_TYPE_STRING;
@@ -390,8 +386,6 @@ thunar_uca_model_get_value (GtkTreeModel *tree_model,
{
ThunarUcaModelItem *item = ((GList *) iter->user_data)->data;
ThunarUcaModel *uca_model = THUNAR_UCA_MODEL (tree_model);
- GtkIconSource *icon_source;
- GtkIconSet *icon_set;
gchar *str;
g_return_if_fail (THUNAR_UCA_IS_MODEL (uca_model));
@@ -427,31 +421,6 @@ thunar_uca_model_get_value (GtkTreeModel *tree_model,
g_value_set_uint (value, item->types);
break;
- case THUNAR_UCA_MODEL_COLUMN_STOCK_ID:
- if (item->stock_id == NULL && item->icon != NULL)
- {
- /* allocate a new icon set for the item */
- icon_set = gtk_icon_set_new ();
- icon_source = gtk_icon_source_new ();
- if (g_path_is_absolute (item->icon))
- gtk_icon_source_set_filename (icon_source, item->icon);
- else
- gtk_icon_source_set_icon_name (icon_source, item->icon);
- gtk_icon_set_add_source (icon_set, icon_source);
- gtk_icon_source_free (icon_source);
-
- /* generate a unique stock-id for the icon */
- item->stock_id = g_strdup_printf ("thunar-uca-%p", item);
-
- /* register the icon set */
- gtk_icon_factory_add (uca_model->icon_factory, item->stock_id, icon_set);
-
- /* cleanup */
- gtk_icon_set_unref (icon_set);
- }
- g_value_set_static_string (value, item->stock_id);
- break;
-
case THUNAR_UCA_MODEL_COLUMN_STOCK_LABEL:
str = g_markup_printf_escaped ("<b>%s</b>\n%s", (item->name != NULL) ? item->name : "", (item->description != NULL) ? item->description : "");
g_value_take_string (value, str);
@@ -608,7 +577,6 @@ thunar_uca_model_item_reset (ThunarUcaModelItem *item)
/* release the previous values... */
g_strfreev (item->patterns);
g_free (item->description);
- g_free (item->stock_id);
g_free (item->command);
g_free (item->name);
g_free (item->icon);
diff --git a/plugins/thunar-uca/thunar-uca-model.h b/plugins/thunar-uca/thunar-uca-model.h
index 2d8e291c..d7782700 100644
--- a/plugins/thunar-uca/thunar-uca-model.h
+++ b/plugins/thunar-uca/thunar-uca-model.h
@@ -43,7 +43,6 @@ typedef enum
THUNAR_UCA_MODEL_COLUMN_COMMAND,
THUNAR_UCA_MODEL_COLUMN_PATTERNS,
THUNAR_UCA_MODEL_COLUMN_TYPES,
- THUNAR_UCA_MODEL_COLUMN_STOCK_ID,
THUNAR_UCA_MODEL_COLUMN_STOCK_LABEL,
THUNAR_UCA_MODEL_N_COLUMNS,
} ThunarUcaModelColumn;
diff --git a/plugins/thunar-uca/thunar-uca-provider.c b/plugins/thunar-uca/thunar-uca-provider.c
index 63bae6c6..3c5550a3 100644
--- a/plugins/thunar-uca/thunar-uca-provider.c
+++ b/plugins/thunar-uca/thunar-uca-provider.c
@@ -208,7 +208,7 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
GList *actions = NULL;
GList *paths;
GList *lp;
- gchar *stock_id;
+ gchar *icon_name;
gchar *tooltip;
gchar *label;
gchar *name;
@@ -222,7 +222,7 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
/* determine the label, tooltip and stock-id for the item */
gtk_tree_model_get (GTK_TREE_MODEL (uca_provider->model), &iter,
THUNAR_UCA_MODEL_COLUMN_NAME, &label,
- THUNAR_UCA_MODEL_COLUMN_STOCK_ID, &stock_id,
+ THUNAR_UCA_MODEL_COLUMN_ICON, &icon_name,
THUNAR_UCA_MODEL_COLUMN_DESCRIPTION, &tooltip,
-1);
@@ -230,7 +230,8 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
name = g_strdup_printf ("ThunarUca::action-%d", ++uca_provider->last_action_id);
/* create the new action with the given parameters */
- action = gtk_action_new (name, label, tooltip, stock_id);
+ action = gtk_action_new (name, label, tooltip, NULL);
+ gtk_action_set_icon_name (action, icon_name);
/* grab a tree row reference on the given path */
row = gtk_tree_row_reference_new (GTK_TREE_MODEL (uca_provider->model), lp->data);
@@ -253,7 +254,7 @@ thunar_uca_provider_get_file_actions (ThunarxMenuProvider *menu_provider,
actions = g_list_prepend (actions, action);
/* cleanup */
- g_free (stock_id);
+ g_free (icon_name);
g_free (tooltip);
g_free (label);
g_free (name);