[Nautilus-list] [PATCH] allow single click in preferences and remove old user level code
- From: David Emory Watson <dwatson cs ucr edu>
- To: nautilus-list lists eazel com
- Cc: darin bentspoon com, dwatson cs ucr edu
- Subject: [Nautilus-list] [PATCH] allow single click in preferences and remove old user level code
- Date: Tue, 19 Feb 2002 02:32:08 -0800
Changelog -
eel/eel-preferences-box.c:
(preferences_box_category_list_recreate): Rename a variable.
(category_list_row_activated_callback): Removed.
(category_list_row_selected_callback): Modified from previous callback
to deal with GtkTreeSelection instead of GtkTreeView.
(eel_preferences_box_new): Connect to "changed" signal.
(user_level_changed_callback): Removed.
Index: eel/eel-preferences-box.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-preferences-box.c,v
retrieving revision 1.15
diff -p -u -r1.15 eel-preferences-box.c
--- eel/eel-preferences-box.c 2002/02/12 15:21:03 1.15
+++ eel/eel-preferences-box.c 2002/02/19 10:23:30
@@ -59,7 +59,7 @@ struct EelPreferencesBoxDetails
GtkWidget *pane_notebook;
GList *panes;
char *selected_pane;
- guint row_activated_signal_id;
+ guint row_selected_signal_id;
};
/* EelPreferencesBoxClass methods */
@@ -79,15 +79,13 @@ static PaneInfo *pane_info_new
static void pane_info_free (PaneInfo *info);
/* Category list callbacks */
-static void category_list_row_activated_callback (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- gpointer callback_data);
+static void
+category_list_row_selected_callback (GtkTreeSelection *selection,
+ gpointer callbeck_data);
/* Convience functions */
static GtkTreeIter *preferences_box_find_row (GtkListStore *model,
const char *pane_name);
-static void user_level_changed_callback (gpointer callback_data);
EEL_CLASS_BOILERPLATE (EelPreferencesBox, eel_preferences_box, GTK_TYPE_HBOX)
@@ -104,11 +102,6 @@ static void
eel_preferences_box_init (EelPreferencesBox *preferences_box)
{
preferences_box->details = g_new0 (EelPreferencesBoxDetails, 1);
-
- eel_preferences_add_callback_while_alive ("user_level",
- user_level_changed_callback,
- preferences_box,
- G_OBJECT (preferences_box));
}
/*
@@ -247,9 +240,9 @@ preferences_box_category_list_recreate (
/* Block the select_row signal so that the 1st item doesnt get selected.
* Otherwise, we lose the selected_pane.
*/
- g_assert (preferences_box->details->row_activated_signal_id != 0);
- g_signal_handler_block (preferences_box->details->category_view,
- preferences_box->details->row_activated_signal_id);
+ g_assert (preferences_box->details->row_selected_signal_id != 0);
+ g_signal_handler_block (gtk_tree_view_get_selection (preferences_box->details->category_view),
+ preferences_box->details->row_selected_signal_id);
gtk_list_store_clear (preferences_box->details->category_store);
@@ -274,8 +267,8 @@ preferences_box_category_list_recreate (
}
}
- g_signal_handler_unblock (preferences_box->details->category_view,
- preferences_box->details->row_activated_signal_id);
+ g_signal_handler_unblock (gtk_tree_view_get_selection (preferences_box->details->category_view),
+ preferences_box->details->row_selected_signal_id);
gtk_widget_queue_resize (GTK_WIDGET (preferences_box->details->category_view));
@@ -331,21 +324,18 @@ pane_info_free (PaneInfo *info)
* Category list callbacks
*/
static void
-category_list_row_activated_callback (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- gpointer callback_data)
+category_list_row_selected_callback (GtkTreeSelection *selection,
+ gpointer callback_data)
{
GtkTreeIter iter;
GtkTreeModel *model;
char *pane_name = NULL;
-
- g_return_if_fail (EEL_IS_PREFERENCES_BOX (callback_data));
- model = gtk_tree_view_get_model (tree_view);
+ g_return_if_fail (EEL_IS_PREFERENCES_BOX (callback_data));
- if (!gtk_tree_model_get_iter (model, &iter, path))
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
return;
+ }
gtk_tree_model_get (model, &iter, CATEGORY_COLUMN, &pane_name, -1);
@@ -394,10 +384,10 @@ eel_preferences_box_new (void)
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (preferences_box->details->category_view),
GTK_SELECTION_BROWSE);
- preferences_box->details->row_activated_signal_id =
- g_signal_connect (preferences_box->details->category_view,
- "row_activated",
- G_CALLBACK (category_list_row_activated_callback),
+ preferences_box->details->row_selected_signal_id =
+ g_signal_connect (gtk_tree_view_get_selection (preferences_box->details->category_view),
+ "changed",
+ G_CALLBACK (category_list_row_selected_callback),
preferences_box);
gtk_box_pack_start (GTK_BOX (preferences_box), tree_view, FALSE, TRUE, 0);
@@ -589,14 +579,6 @@ eel_preferences_box_populate (EelPrefere
}
eel_preferences_box_update (preferences_box);
-}
-
-static void
-user_level_changed_callback (gpointer callback_data)
-{
- g_return_if_fail (EEL_IS_PREFERENCES_BOX (callback_data));
-
- eel_preferences_box_update (EEL_PREFERENCES_BOX (callback_data));
}
GtkWidget *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]