Commit 49044eda authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

Remove tearoff menus, they sucked. We can readd them when we implement

Thu Jan 10 23:27:54 2002  George Lebl <jirka@5z.com>

	* Makefile.am, foobar-widget.c, menu.[ch], panel-config.c,
	  panel-util.c, panel.c, session.c, tearoffitem.[ch]:
	  Remove tearoff menus, they sucked.  We can readd them when
	  we implement them properly.

	* gnome-run.c:  Port to TreeView, so we are now completely
	  de-deprecated.  Also read from all-applications:/  To
	  actually allways get all entries.
parent 1abec36f
Thu Jan 10 23:27:54 2002 George Lebl <jirka@5z.com>
* Makefile.am, foobar-widget.c, menu.[ch], panel-config.c,
panel-util.c, panel.c, session.c, tearoffitem.[ch]:
Remove tearoff menus, they sucked. We can readd them when
we implement them properly.
* gnome-run.c: Port to TreeView, so we are now completely
de-deprecated. Also read from all-applications:/ To
actually allways get all entries.
2002-01-11 Glynn Foster <glynn.foster@sun.com> 2002-01-11 Glynn Foster <glynn.foster@sun.com>
* applet.c, drawer.c, drawer.h, gnome-panel-properties.c, * applet.c, drawer.c, drawer.h, gnome-panel-properties.c,
......
...@@ -73,7 +73,6 @@ panel_sources = \ ...@@ -73,7 +73,6 @@ panel_sources = \
sliding-widget.c \ sliding-widget.c \
floating-widget.c \ floating-widget.c \
rgb-stuff.c \ rgb-stuff.c \
tearoffitem.c \
panel.c \ panel.c \
applet.c \ applet.c \
logout.c \ logout.c \
...@@ -113,7 +112,6 @@ panel_headers = \ ...@@ -113,7 +112,6 @@ panel_headers = \
sliding-widget.h \ sliding-widget.h \
floating-widget.h \ floating-widget.h \
rgb-stuff.h \ rgb-stuff.h \
tearoffitem.h \
panel.h \ panel.h \
applet.h \ applet.h \
logout.h \ logout.h \
......
...@@ -128,17 +128,6 @@ pixmap_menu_item_new (const char *text, const char *try_file, gboolean force_ima ...@@ -128,17 +128,6 @@ pixmap_menu_item_new (const char *text, const char *try_file, gboolean force_ima
return item; return item;
} }
static void
add_tearoff (GtkMenuShell *menu)
{
GtkWidget *item;
item = gtk_tearoff_menu_item_new ();
if (panel_menu_have_tearoff ())
gtk_widget_show (item);
gtk_menu_shell_prepend (menu, item);
}
static gboolean static gboolean
foobar_leave_notify (GtkWidget *widget, foobar_leave_notify (GtkWidget *widget,
GdkEventCrossing *event) GdkEventCrossing *event)
...@@ -183,8 +172,6 @@ append_actions_menu (GtkWidget *menu_bar) ...@@ -183,8 +172,6 @@ append_actions_menu (GtkWidget *menu_bar)
menu = panel_menu_new (); menu = panel_menu_new ();
add_tearoff (GTK_MENU_SHELL (menu));
menu = panel_menu_new (); menu = panel_menu_new ();
item = pixmap_menu_item_new (_("Run..."), "gnome-run.png", item = pixmap_menu_item_new (_("Run..."), "gnome-run.png",
...@@ -225,8 +212,6 @@ append_actions_menu (GtkWidget *menu_bar) ...@@ -225,8 +212,6 @@ append_actions_menu (GtkWidget *menu_bar)
G_CALLBACK (panel_quit), 0); G_CALLBACK (panel_quit), 0);
setup_internal_applet_drag (item, "LOGOUT:NEW"); setup_internal_applet_drag (item, "LOGOUT:NEW");
add_tearoff (GTK_MENU_SHELL (menu));
item = gtk_menu_item_new_with_label (_("Actions")); item = gtk_menu_item_new_with_label (_("Actions"));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), item); gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), item);
...@@ -496,14 +481,10 @@ append_clock_menu (FoobarWidget *foo, GtkWidget *menu_bar) ...@@ -496,14 +481,10 @@ append_clock_menu (FoobarWidget *foo, GtkWidget *menu_bar)
menu2 = panel_menu_new (); menu2 = panel_menu_new ();
append_format_items (menu2); append_format_items (menu2);
add_tearoff (GTK_MENU_SHELL (menu2));
item = gtk_image_menu_item_new_with_label (_("Format")); item = gtk_image_menu_item_new_with_label (_("Format"));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu2); gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu2);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
add_tearoff (GTK_MENU_SHELL (menu));
item = gtk_menu_item_new (); item = gtk_menu_item_new ();
foo->clock_label = gtk_label_new (""); foo->clock_label = gtk_label_new ("");
...@@ -617,7 +598,7 @@ programs_menu_to_display (GtkWidget *menu) ...@@ -617,7 +598,7 @@ programs_menu_to_display (GtkWidget *menu)
flags |= MAIN_MENU_KDE_SUB; flags |= MAIN_MENU_KDE_SUB;
if (got_distro_menus ()) if (got_distro_menus ())
flags |= MAIN_MENU_DISTRIBUTION_SUB; flags |= MAIN_MENU_DISTRIBUTION_SUB;
create_root_menu (menu, TRUE, flags, TRUE, FALSE, FALSE /* run_item */); create_root_menu (menu, TRUE, flags, FALSE, FALSE /* run_item */);
} }
} }
...@@ -1061,7 +1042,7 @@ foobar_widget_instance_init (FoobarWidget *foo) ...@@ -1061,7 +1042,7 @@ foobar_widget_instance_init (FoobarWidget *foo)
if (got_distro_menus ()) if (got_distro_menus ())
flags |= MAIN_MENU_DISTRIBUTION_SUB; flags |= MAIN_MENU_DISTRIBUTION_SUB;
menu = create_root_menu (NULL, TRUE, flags, TRUE, FALSE, FALSE /* run_item */); menu = create_root_menu (NULL, TRUE, flags, FALSE, FALSE /* run_item */);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu_bar), menuitem);
g_signal_connect (G_OBJECT (menu), "show", g_signal_connect (G_OBJECT (menu), "show",
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
* USA * USA
*/ */
/* FIXME: because of CList */
#undef GTK_DISABLE_DEPRECATED
#include <config.h> #include <config.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -52,6 +49,16 @@ ...@@ -52,6 +49,16 @@
#define ADVANCED_DIALOG_KEY "advanced_run_dialog" #define ADVANCED_DIALOG_KEY "advanced_run_dialog"
#define ICON_SIZE 20
enum {
COLUMN_ICON,
COLUMN_FULLNAME,
COLUMN_COMMENT,
COLUMN_NAME,
NUM_COLUMNS
};
extern GtkTooltips *panel_tooltips; extern GtkTooltips *panel_tooltips;
extern gboolean no_run_box; extern gboolean no_run_box;
...@@ -193,7 +200,7 @@ static void ...@@ -193,7 +200,7 @@ static void
run_dialog_response (GtkWidget *w, int response, gpointer data) run_dialog_response (GtkWidget *w, int response, gpointer data)
{ {
GtkEntry *entry; GtkEntry *entry;
GtkWidget *clist; GtkWidget *list;
GtkToggleButton *terminal; GtkToggleButton *terminal;
char **argv = NULL; char **argv = NULL;
char **temp_argv = NULL; char **temp_argv = NULL;
...@@ -213,25 +220,37 @@ run_dialog_response (GtkWidget *w, int response, gpointer data) ...@@ -213,25 +220,37 @@ run_dialog_response (GtkWidget *w, int response, gpointer data)
goto return_and_close; goto return_and_close;
} }
clist = g_object_get_data (G_OBJECT (run_dialog), "dentry_list"); list = g_object_get_data (G_OBJECT (run_dialog), "dentry_list");
terminal = GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT(w), terminal = GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT(w),
"terminal")); "terminal"));
if (g_object_get_data (G_OBJECT (run_dialog), "use_list")) { if (g_object_get_data (G_OBJECT (run_dialog), "use_list")) {
char *name; char *name;
GtkTreeSelection *selection;
if (GTK_CLIST (clist)->selection == NULL) GtkTreeModel *model;
return; GtkTreeIter iter;
GValue value = {0, };
name = gtk_clist_get_row_data (GTK_CLIST (clist),
GPOINTER_TO_INT (GTK_CLIST (clist)->selection->data)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
/* just return if nothing selected */
if ( ! gtk_tree_selection_get_selected (selection,
&model, &iter))
return;
gtk_tree_model_get_value (model, &iter,
COLUMN_NAME,
&value);
name = g_strdup (g_value_get_string (&value));
g_value_unset (&value);
if (name != NULL) { if (name != NULL) {
GError *error = NULL; GError *error = NULL;
GnomeDesktopItem *ditem; GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (name, ditem = gnome_desktop_item_new_from_uri (name,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS, GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
&error); &error);
if (ditem != NULL) { if (ditem != NULL) {
/* Honor "run in terminal" button */ /* Honor "run in terminal" button */
gnome_desktop_item_set_boolean (ditem, gnome_desktop_item_set_boolean (ditem,
...@@ -257,6 +276,8 @@ run_dialog_response (GtkWidget *w, int response, gpointer data) ...@@ -257,6 +276,8 @@ run_dialog_response (GtkWidget *w, int response, gpointer data)
if (ditem != NULL) { if (ditem != NULL) {
gnome_desktop_item_unref (ditem); gnome_desktop_item_unref (ditem);
} }
g_free (name);
} }
} else { } else {
entry = GTK_ENTRY (g_object_get_data (G_OBJECT (w), "entry")); entry = GTK_ENTRY (g_object_get_data (G_OBJECT (w), "entry"));
...@@ -477,28 +498,39 @@ sync_entry_to_list (GtkWidget *dialog) ...@@ -477,28 +498,39 @@ sync_entry_to_list (GtkWidget *dialog)
static void static void
sync_list_to_entry (GtkWidget *dialog) sync_list_to_entry (GtkWidget *dialog)
{ {
GtkWidget *clist; GtkWidget *list;
GtkWidget *entry; GtkWidget *entry;
GtkWidget *terminal_toggle; GtkWidget *terminal_toggle;
gchar *name; gchar *name;
GtkTreeSelection *selection;
GtkTreeModel *model;
GtkTreeIter iter;
g_object_set_data (G_OBJECT (dialog), g_object_set_data (G_OBJECT (dialog),
"sync_entry_to_list_blocked", "sync_entry_to_list_blocked",
GINT_TO_POINTER (TRUE)); GINT_TO_POINTER (TRUE));
clist = g_object_get_data (G_OBJECT (dialog), "dentry_list"); list = g_object_get_data (G_OBJECT (dialog), "dentry_list");
entry = g_object_get_data (G_OBJECT (dialog), "entry"); entry = g_object_get_data (G_OBJECT (dialog), "entry");
terminal_toggle = g_object_get_data (G_OBJECT (dialog), "terminal"); terminal_toggle = g_object_get_data (G_OBJECT (dialog), "terminal");
if (GTK_CLIST (clist)->selection) { selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list));
name = gtk_clist_get_row_data (GTK_CLIST (clist),
GPOINTER_TO_INT (GTK_CLIST (clist)->selection->data)); if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
if (name) { GValue value = {0, };
gtk_tree_model_get_value (model, &iter,
COLUMN_NAME,
&value);
name = g_strdup (g_value_get_string (&value));
g_value_unset (&value);
if (name != NULL) {
GnomeDesktopItem *ditem; GnomeDesktopItem *ditem;
ditem = gnome_desktop_item_new_from_file (name, ditem = gnome_desktop_item_new_from_uri (name,
GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS, GNOME_DESKTOP_ITEM_LOAD_NO_TRANSLATIONS,
NULL /* error */); NULL /* error */);
if (ditem != NULL) { if (ditem != NULL) {
gboolean terminal; gboolean terminal;
const char *exec; const char *exec;
...@@ -517,9 +549,11 @@ sync_list_to_entry (GtkWidget *dialog) ...@@ -517,9 +549,11 @@ sync_list_to_entry (GtkWidget *dialog)
gtk_toggle_button_set_active gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (terminal_toggle), (GTK_TOGGLE_BUTTON (terminal_toggle),
terminal); terminal);
gnome_desktop_item_unref (ditem); gnome_desktop_item_unref (ditem);
} }
g_free (name);
} }
} }
...@@ -659,186 +693,144 @@ create_advanced_contents (void) ...@@ -659,186 +693,144 @@ create_advanced_contents (void)
return vbox; return vbox;
} }
static void
scan_dir_recurse (DirRec *dr,
GSList **entry_list)
{
GSList *li;
for (li = dr->recs; li != NULL; li = li->next) {
FileRec *fr = li->data;
if (fr->type == FILE_REC_FILE) {
if (fr->goad_id != NULL)
continue; /* applet */
*entry_list = g_slist_prepend (*entry_list, fr);
} else if (fr->type == FILE_REC_DIR) {
scan_dir_recurse ((DirRec*)fr, entry_list);
} else {
continue;
}
}
}
static int static int
sort_by_name (FileRec *fra, sort_by_name (FileRec *fra,
FileRec *frb) FileRec *frb)
{ {
return strcoll (fra->fullname, frb->fullname); /* FIXME: there is no utf8 strcoll afaik, so
* we just strcmp for now, this is evil, but
* it works mostly somewhat */
return strcmp (fra->fullname, frb->fullname);
} }
#define CLIST_ICON_SIZE 20 static void
add_columns (GtkTreeView *treeview)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
renderer = gtk_cell_renderer_pixbuf_new ();
column = gtk_tree_view_column_new_with_attributes (NULL,
renderer,
"pixbuf", COLUMN_ICON,
NULL);
gtk_tree_view_column_set_clickable (column, FALSE);
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column),
ICON_SIZE);
gtk_tree_view_append_column (treeview, column);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Applications"),
renderer,
"text",
COLUMN_FULLNAME,
NULL);
gtk_tree_view_column_set_clickable (column, FALSE);
gtk_tree_view_append_column (treeview, column);
}
/* Called when simple contents are switched to or first shown */ /* Called when simple contents are switched to or first shown */
static void static void
simple_contents_shown (GtkWidget *vbox, fill_list (GtkWidget *list)
GtkWidget *dialog)
{ {
GtkWidget *advanced;
GSList *entries;
GSList *tmp; GSList *tmp;
GSList *files; GSList *files;
GSList *prev; GSList *prev;
GtkWidget *clist;
char *prev_name; char *prev_name;
GtkListStore *store;
FileRec *all_dir;
clist = g_object_get_data (G_OBJECT (dialog), "dentry_list"); /* create list store */
advanced = g_object_get_data (G_OBJECT (dialog), "advanced"); store = gtk_list_store_new (NUM_COLUMNS,
GDK_TYPE_PIXBUF,
if (advanced) { G_TYPE_STRING,
/* If we have advanced contents containing a command, G_TYPE_STRING,
* try to match that command to some desktop entry G_TYPE_STRING);
* in order to fill in our default.
*/ all_dir = fr_get_dir ("all-applications:/");
if (all_dir != NULL) {
/* FIXME */ files = g_slist_copy (((DirRec *)all_dir)->recs);
} } else {
files = NULL;
}
if (GTK_CLIST (clist)->rows == 0) { /* Collate */
GdkPixmap *spacer_pixmap; files = g_slist_sort (files, (GCompareFunc) sort_by_name);
GdkBitmap *spacer_mask;
GdkGC *gc;
GdkColor color;
/* Create invisible pixmap/mask to put space
* before entries with no icon
*/
spacer_pixmap = gdk_pixmap_new (NULL,
CLIST_ICON_SIZE,
CLIST_ICON_SIZE,
gtk_widget_get_visual (clist)->depth);
spacer_mask = gdk_pixmap_new (NULL,
CLIST_ICON_SIZE,
CLIST_ICON_SIZE,
1);
gc = gdk_gc_new (spacer_mask);
color.pixel = 0;
gdk_gc_set_foreground (gc, &color);
gdk_draw_rectangle (spacer_mask,
gc,
TRUE, 0, 0, CLIST_ICON_SIZE, CLIST_ICON_SIZE);
g_object_unref (G_OBJECT (gc));
gc = NULL;
/* FIXME: this is not actually the list of all directories,
* as it only includes the cache, this just seems like all,
* this is wrong! */
entries = fr_get_all_dirs ();
files = NULL;
tmp = entries;
while (tmp != NULL) {
DirRec *dr = tmp->data;
scan_dir_recurse (dr, &files);
tmp = tmp->next;
}
/* Collate */ /* Strip duplicates */
files = g_slist_sort (files, (GCompareFunc) sort_by_name); tmp = files;
prev = NULL;
prev_name = NULL;
while (tmp) {
FileRec *fr;
/* Strip duplicates */ fr = tmp->data;
tmp = files; if (prev_name && strcmp (fr->fullname, prev_name) == 0) {
prev = NULL; GSList *del = tmp;
prev_name = NULL;
while (tmp) {
FileRec *fr;
fr = tmp->data;
if (prev_name && strcmp (fr->fullname, prev_name) == 0) {
GSList *del = tmp;
prev->next = del->next;
g_slist_free_1 (del);
tmp = prev->next;
} else {
prev = tmp;
prev_name = fr->fullname;
tmp = tmp->next;
}
}
tmp = files;
while (tmp != NULL) {
FileRec *fr;
GdkPixbuf *pixbuf;
GdkPixmap *pixmap;
GdkBitmap *mask;
int row;
char *text[2];
fr = tmp->data;
if (fr->icon != NULL) { prev->next = del->next;
pixbuf = gdk_pixbuf_new_from_file (fr->icon, NULL); g_slist_free_1 (del);
} else { tmp = prev->next;
pixbuf = NULL; } else {
} prev = tmp;
prev_name = fr->fullname;
if (pixbuf != NULL) { tmp = tmp->next;
GdkPixbuf *scaled; }
scaled = gdk_pixbuf_scale_simple (pixbuf, CLIST_ICON_SIZE, CLIST_ICON_SIZE, GDK_INTERP_BILINEAR); }
gdk_pixbuf_render_pixmap_and_mask (scaled,
&pixmap, &mask, 128);
g_object_unref (G_OBJECT (pixbuf));
g_object_unref (G_OBJECT (scaled));
} else {
pixmap = spacer_pixmap;
mask = spacer_mask;
}
text[0] = fr->fullname; tmp = files;
text[1] = fr->comment; while (tmp != NULL) {
row = gtk_clist_append (GTK_CLIST (clist), GtkTreeIter iter;
text); FileRec *fr;
GdkPixbuf *pixbuf;
gtk_clist_set_pixtext (GTK_CLIST (clist), char *icon;
row, 0,
fr->fullname, fr = tmp->data;
3,
pixmap, mask); icon = gnome_desktop_item_find_icon (fr->icon,
ICON_SIZE /* desired size */,
if (pixbuf) { 0 /* flags */);
if (pixmap) if (icon != NULL) {
g_object_unref (G_OBJECT (pixmap)); pixbuf = gdk_pixbuf_new_from_file (icon, NULL);
if (mask) g_free (icon);
g_object_unref (G_OBJECT (mask)); } else {
} pixbuf = NULL;
}
gtk_clist_set_row_data (GTK_CLIST (clist),
row, fr->name);
tmp = tmp->next;
}
g_object_unref (G_OBJECT (spacer_pixmap)); if (pixbuf != NULL &&
g_object_unref (G_OBJECT (spacer_mask)); (gdk_pixbuf_get_width (pixbuf) != ICON_SIZE ||
g_slist_free (files); gdk_pixbuf_get_height (pixbuf) != ICON_SIZE)) {
} GdkPixbuf *scaled;
scaled = gdk_pixbuf_scale_simple (pixbuf,
ICON_SIZE,
ICON_SIZE,
GDK_INTERP_BILINEAR);
g_object_unref (G_OBJECT (pixbuf));
pixbuf = scaled;
}
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
COLUMN_ICON, pixbuf,
COLUMN_FULLNAME, fr->fullname,
COLUMN_COMMENT, fr->comment,
COLUMN_NAME, fr->name,
-1);
if (pixbuf != NULL)
g_object_unref (G_OBJECT (pixbuf));
tmp = tmp->next;
}
g_slist_free (files);
gtk_tree_view_set_model (GTK_TREE_VIEW (list),
GTK_TREE_MODEL (store));
add_columns (GTK_TREE_VIEW (list));
} }
#define DEFAULT_ICON "nautilus/i-executable.png" #define DEFAULT_ICON "nautilus/i-executable.png"
...@@ -874,14 +866,14 @@ unset_selected (GtkWidget *dialog) ...@@ -874,14 +866,14 @@ unset_selected (GtkWidget *dialog)
GtkWidget *gpixmap; GtkWidget *gpixmap;
GtkWidget *desc_label; GtkWidget *desc_label;
GtkWidget *entry; GtkWidget *entry;
GtkWidget *clist; GtkWidget *list;
char *text; char *text;
label = g_object_get_data (G_OBJECT (dialog), "label"); label = g_object_get_data (G_OBJECT (dialog), "label");
gpixmap = g_object_get_data (G_OBJECT (dialog), "pixmap"); gpixmap = g_object_get_data (G_OBJECT (dialog), "pixmap");
desc_label = g_object_get_data (G_OBJECT (dialog), "desc_label"); desc_label = g_object_get_data (G_OBJECT (dialog), "desc_label");
entry = g_object_get_data (G_OBJECT (dialog), "entry"); entry = g_object_get_data (G_OBJECT (dialog), "entry");
clist = g_object_get_data (G_OBJECT (dialog), "dentry_list"); list = g_object_get_data (G_OBJECT (dialog), "dentry_list");
if (entry != NULL) { if (entry != NULL) {
text = gtk_editable_get_chars (GTK_EDITABLE (entry), text = gtk_editable_get_chars (GTK_EDITABLE (entry),
...@@ -915,45 +907,42 @@ unset_selected (GtkWidget *dialog) ...@@ -915,45 +907,42 @@ unset_selected (GtkWidget *dialog)
g_object_set_data (G_OBJECT (dialog), "use_list", g_object_set_data (G_OBJECT (dialog), "use_list",
GPOINTER_TO_INT (FALSE)); GPOINTER_TO_INT (FALSE));
gtk_tree_selection_unselect_all
gtk_clist_set_selection_mode (GTK_CLIST (clist), (gtk_tree_view_get_selection (GTK_TREE_VIEW (list)));
GTK_SELECTION_SINGLE);
gtk_clist_unselect_all (GTK_CLIST (clist));
} }
static void static void
select_row_handler (GtkCList *clist, selection_changed (GtkTreeSelection *selection,
gint row, gpointer data)
gint column,
GdkEvent *event,
gpointer data)
{ {
GtkWidget *label; GtkWidget *label;
GtkWidget *gpixmap; GtkWidget *gpixmap;
GtkWidget *desc_label; GtkWidget *desc_label;
GtkWidget *dialog = data; GtkWidget *dialog = data;
gchar *name; gchar *name;
GtkTreeModel *model;
GtkTreeIter iter;
GValue value = {0, };
if (clist->selection == NULL) if ( ! gtk_tree_selection_get_selected (selection, &model, &iter))
return; return;
gtk_tree_model_get_value (model, &iter,
COLUMN_NAME,
&value);
name = g_strdup (g_value_get_string (&value));
g_value_unset (&value);
/* Change selection mode once we have a selection */
gtk_clist_set_selection_mode (GTK_CLIST (clist),
GTK_SELECTION_BROWSE);
label = g_object_get_data (G_OBJECT (dialog), "label"); label = g_object_get_data (G_OBJECT (dialog), "label");
gpixmap = g_object_get_data (G_OBJECT (dialog), "pixmap");