[zenity/gnome-3-4] Revert "Added support to --imagelist on tree. Thanks to Joshua Nathaniel Pritikin <jpritikin pobox c
- From: Piotr DrÄg <piotrdrag src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [zenity/gnome-3-4] Revert "Added support to --imagelist on tree. Thanks to Joshua Nathaniel Pritikin <jpritikin pobox c
- Date: Fri, 20 Jul 2012 23:22:00 +0000 (UTC)
commit 4c6811b287a78712a313dd375d2cdfa97a280873
Author: Piotr DrÄg <piotrdrag gmail com>
Date: Sat Jul 21 01:21:35 2012 +0200
Revert "Added support to --imagelist on tree. Thanks to Joshua Nathaniel Pritikin <jpritikin pobox com> now the first column can have an image."
This reverts commit c17eff5863009c69196e92520b150643f1f7937d.
src/option.c | 16 ----------------
src/tree.c | 53 ++++++-----------------------------------------------
src/zenity.h | 1 -
3 files changed, 6 insertions(+), 64 deletions(-)
---
diff --git a/src/option.c b/src/option.c
index ee0e9c2..334ec86 100644
--- a/src/option.c
+++ b/src/option.c
@@ -78,7 +78,6 @@ static gboolean zenity_list_radiolist;
static gchar *zenity_list_print_column;
static gchar *zenity_list_hide_column;
static gboolean zenity_list_hide_header;
-static gboolean zenity_list_imagelist;
#ifdef HAVE_LIBNOTIFY
/* Notification Dialog Options */
@@ -526,15 +525,6 @@ static GOptionEntry list_options[] = {
NULL
},
{
- "imagelist",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_list_imagelist,
- N_("Use an image for first column"),
- NULL
- },
- {
"separator",
'\0',
G_OPTION_FLAG_NOALIAS,
@@ -1366,7 +1356,6 @@ zenity_list_pre_callback (GOptionContext *context,
zenity_list_columns = NULL;
zenity_list_checklist = FALSE;
zenity_list_radiolist = FALSE;
- zenity_list_imagelist = FALSE;
zenity_list_hide_header = FALSE;
zenity_list_print_column = NULL;
zenity_list_hide_column = NULL;
@@ -1698,7 +1687,6 @@ zenity_list_post_callback (GOptionContext *context,
results->tree_data->checkbox = zenity_list_checklist;
results->tree_data->radiobox = zenity_list_radiolist;
- results->tree_data->imagebox = zenity_list_imagelist;
results->tree_data->multi = zenity_general_multiple;
results->tree_data->editable = zenity_general_editable;
results->tree_data->print_column = zenity_list_print_column;
@@ -1718,10 +1706,6 @@ zenity_list_post_callback (GOptionContext *context,
zenity_option_error (zenity_option_get_name (list_options, &zenity_list_radiolist),
ERROR_SUPPORT);
- if (zenity_list_imagelist)
- zenity_option_error (zenity_option_get_name (list_options, &zenity_list_imagelist),
- ERROR_SUPPORT);
-
if (zenity_list_print_column)
zenity_option_error (zenity_option_get_name (list_options, &zenity_list_print_column),
ERROR_SUPPORT);
diff --git a/src/tree.c b/src/tree.c
index 4234fc1..b347b15 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -87,44 +87,6 @@ zenity_tree_toggled_callback (GtkCellRendererToggle *cell, gchar *path_string, g
gtk_tree_path_free (path);
}
-static void
-zenity_load_pixbuf (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gpointer data)
-{
- static GHashTable *pixbuf_cache = NULL;
- GError *error = NULL;
- GdkPixbuf *pixbuf;
- gchar *str;
-
- gtk_tree_model_get (tree_model, iter, 0, &str, -1);
-
- if (!str)
- return;
-
- if (!pixbuf_cache) {
- pixbuf_cache = g_hash_table_new (g_str_hash, g_str_equal);
- g_assert(pixbuf_cache);
- }
-
- pixbuf = g_hash_table_lookup (pixbuf_cache, str);
-
- if (!pixbuf) {
- pixbuf = gdk_pixbuf_new_from_file (str, &error);
- if (!pixbuf)
- g_warning ("Failed to load '%s'", str);
-
- g_hash_table_insert (pixbuf_cache, g_strdup (str), pixbuf);
- }
-
- if (pixbuf)
- g_object_set (cell, "pixbuf", pixbuf, NULL);
-
- g_free (str);
-}
-
static gboolean
zenity_tree_handle_stdin (GIOChannel *channel,
GIOCondition condition,
@@ -287,7 +249,7 @@ zenity_tree_fill_entries (GtkTreeView *tree_view,
GtkWidget *scrolled_window;
GtkRequisition rectangle;
- gtk_widget_get_preferred_size (GTK_WIDGET (tree_view), &rectangle, NULL);
+ gtk_widget_size_request (GTK_WIDGET (tree_view), &rectangle);
scrolled_window = GTK_WIDGET (gtk_builder_get_object (builder,
"zenity_tree_window"));
gtk_widget_set_size_request (scrolled_window, -1, rectangle.height);
@@ -367,7 +329,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
return;
}
- if (tree_data->checkbox + tree_data->radiobox + tree_data->imagebox > 1) {
+ if (tree_data->checkbox && tree_data->radiobox) {
g_printerr (_("You should use only one List dialog type.\n"));
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
return;
@@ -471,12 +433,6 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
column = gtk_tree_view_column_new_with_attributes (tmp->data,
cell_renderer,
"active", column_index, NULL);
- } else if (tree_data->imagebox) {
- GtkCellRenderer *cell_renderer = gtk_cell_renderer_pixbuf_new ();
- column = gtk_tree_view_column_new_with_attributes (tmp->data,
- cell_renderer, NULL);
- gtk_tree_view_column_set_cell_data_func (column, cell_renderer,
- zenity_load_pixbuf, NULL, NULL);
}
else {
if (tree_data->editable) {
@@ -701,7 +657,10 @@ zenity_tree_row_activated (GtkTreeView *tree_view, GtkTreePath *tree_path,
{
ZenityData *zen_data = data;
GtkTreeSelection *selection;
-
+ GtkTreeModel *model;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
gtk_tree_selection_selected_foreach (selection,
(GtkTreeSelectionForeachFunc) zenity_tree_dialog_get_selected,
diff --git a/src/zenity.h b/src/zenity.h
index 30c497b..c5414fe 100644
--- a/src/zenity.h
+++ b/src/zenity.h
@@ -121,7 +121,6 @@ typedef struct {
gboolean checkbox;
gboolean radiobox;
gboolean hide_header;
- gboolean imagebox;
gchar *separator;
gboolean multi;
gboolean editable;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]