devhelp r1123 - in trunk: . src



Author: rhult
Date: Sat Oct  4 14:09:02 2008
New Revision: 1123
URL: http://svn.gnome.org/viewvc/devhelp?rev=1123&view=rev

Log:
2008-10-04  Richard Hult  <richard imendio com>

	* src/dh-preferences.c: (dh_preferences_show_dialog):
	* src/dh-search.c: (dh_search_new): Remove option for "advanced
	search", and always enable it. Now that the UI doesn't suck, I
	declare it not advanced ;)


Modified:
   trunk/ChangeLog
   trunk/src/dh-preferences.c
   trunk/src/dh-search.c

Modified: trunk/src/dh-preferences.c
==============================================================================
--- trunk/src/dh-preferences.c	(original)
+++ trunk/src/dh-preferences.c	Sat Oct  4 14:09:02 2008
@@ -31,8 +31,6 @@
 typedef struct {
 	GtkWidget *dialog;
 
-	GtkWidget *advanced_options_button;
-
 	GtkWidget *system_fonts_button;
 	GtkWidget *fonts_table;
 	GtkWidget *variable_font_button;
@@ -43,7 +41,6 @@
 	guint      system_fixed_id;
 	guint      var_id;
 	guint      fixed_id;
-	guint      advanced_options_id;
 } DhPreferences;
 
 #define DH_PREFERENCES(x) ((DhPreferences *) x)
@@ -52,8 +49,6 @@
 							 gpointer          user_data);
 static void     preferences_close_cb                    (GtkButton        *button,
 							 gpointer          user_data);
-static void     preferences_advanced_options_toggled_cb (GtkToggleButton  *button,
-							 gpointer          user_data);
 static void     preferences_system_fonts_toggled_cb     (GtkToggleButton  *button,
 							 gpointer          user_data);
 static void     preferences_var_font_notify_cb          (GConfClient      *client,
@@ -68,10 +63,6 @@
 							 guint             cnxn_id,
 							 GConfEntry       *entry,
 							 gpointer          user_data);
-static void     preferences_advanced_options_notify_cb  (GConfClient      *client,
-							 guint             cnxn_id,
-							 GConfEntry       *entry,
-							 gpointer          user_data);
 static void     preferences_connect_gconf_listeners     (void);
 static void     preferences_get_font_names              (gboolean          use_system_fonts,
 							 gchar           **variable,
@@ -116,9 +107,6 @@
 				    prefs->use_system_fonts_id);
 	
 	gconf_client_notify_remove (gconf_client,
-				    prefs->advanced_options_id);
-
-	gconf_client_notify_remove (gconf_client,
 				    prefs->system_var_id);
 
 	gconf_client_notify_remove (gconf_client,
@@ -149,24 +137,6 @@
 }
 
 static void
-preferences_advanced_options_toggled_cb (GtkToggleButton *button, 
-					 gpointer         user_data)
-{
-	DhPreferences *prefs;
-	gboolean       active;
-	GConfClient   *gconf_client;
-	
-	prefs = DH_PREFERENCES (user_data);
-
-	active = gtk_toggle_button_get_active (button);
-
-	gconf_client = dh_base_get_gconf_client (dh_base_get ());
-	gconf_client_set_bool (gconf_client,
-			       GCONF_ADVANCED_OPTIONS,
-			       active, NULL);
-}
-
-static void
 preferences_system_fonts_toggled_cb (GtkToggleButton *button, 
 				     gpointer         user_data)
 {
@@ -274,25 +244,6 @@
 }
 
 static void
-preferences_advanced_options_notify_cb (GConfClient *client,
-					guint        cnxn_id,
-					GConfEntry  *entry,
-					gpointer     user_data)
-{
-	DhPreferences *prefs;
-	gboolean       advanced_options;
-	
-	prefs = DH_PREFERENCES (user_data);
-
-	advanced_options = gconf_value_get_bool (gconf_entry_get_value (entry));
-
-	if (prefs->advanced_options_button) { 
-		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->advanced_options_button),
-					      advanced_options);
-	}
-}
-
-static void
 preferences_connect_gconf_listeners (void)
 {
 	GConfClient *gconf_client;
@@ -305,12 +256,6 @@
 					 preferences_use_system_font_notify_cb,
 					 prefs, NULL, NULL);
 	
-	prefs->advanced_options_id =
-		gconf_client_notify_add (gconf_client,
-					 GCONF_ADVANCED_OPTIONS,
-					 preferences_advanced_options_notify_cb,
-					 prefs, NULL, NULL);
-
 	prefs->system_var_id =
 		gconf_client_notify_add (gconf_client,
 					 GCONF_SYSTEM_VARIABLE_FONT,
@@ -412,7 +357,6 @@
 dh_preferences_show_dialog (GtkWindow *parent)
 {
 	gboolean     use_system_fonts;
-	gboolean     advanced_options;
 	gchar       *var_font_name, *fixed_font_name;
 	GladeXML    *gui;
 	GConfClient *gconf_client;
@@ -429,7 +373,6 @@
 				 "preferences_dialog",
 				 NULL,
 				 "preferences_dialog", &prefs->dialog,
-				 "advanced_button", &prefs->advanced_options_button,
 				 "fonts_table", &prefs->fonts_table,
 				 "system_fonts_button", &prefs->system_fonts_button,
 				 "variable_font_button", &prefs->variable_font_button,
@@ -442,7 +385,6 @@
 			  "fixed_font_button", "font_set", preferences_font_set_cb,
 			  "close_button", "clicked", preferences_close_cb,
 			  "system_fonts_button", "toggled", preferences_system_fonts_toggled_cb,
-			  "advanced_button", "toggled", preferences_advanced_options_toggled_cb,
 			  NULL);
 
 	gconf_client = dh_base_get_gconf_client (dh_base_get ());
@@ -454,12 +396,6 @@
 				      use_system_fonts);
 	gtk_widget_set_sensitive (prefs->fonts_table, !use_system_fonts);
 
-	advanced_options = gconf_client_get_bool (gconf_client,
-						  GCONF_ADVANCED_OPTIONS,
-						  NULL);
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->advanced_options_button),
-				      advanced_options);
-
 	preferences_get_font_names (FALSE, &var_font_name, &fixed_font_name);
 	
 	if (var_font_name) {

Modified: trunk/src/dh-search.c
==============================================================================
--- trunk/src/dh-search.c	(original)
+++ trunk/src/dh-search.c	Sat Oct  4 14:09:02 2008
@@ -40,8 +40,6 @@
 
         DhLink         *selected_link;
 
-        GtkWidget      *advanced_box;
-
         GtkWidget      *book_combo;
         GtkWidget      *entry;
         GtkWidget      *hitlist;
@@ -50,19 +48,10 @@
 
         guint           idle_complete;
         guint           idle_filter;
-
-        guint           advanced_options_id;
-
-        GString        *entry_str;
 } DhSearchPriv;
 
 static void         dh_search_init                    (DhSearch         *search);
 static void         dh_search_class_init              (DhSearchClass    *klass);
-static void         search_advanced_options_setup     (DhSearch         *search);
-static void         search_advanced_options_notify_cb (GConfClient      *client,
-                                                       guint             cnxn_id,
-                                                       GConfEntry       *entry,
-                                                       gpointer          user_data);
 static void         search_selection_changed_cb       (GtkTreeSelection *selection,
                                                        DhSearch         *content);
 static gboolean     search_tree_button_press_cb       (GtkTreeView      *view,
@@ -103,17 +92,11 @@
 search_finalize (GObject *object)
 {
         DhSearchPriv *priv;
-        GConfClient  *gconf_client;
 
         priv = GET_PRIVATE (object);
 
-        g_string_free (priv->entry_str, TRUE);
-
         g_completion_free (priv->completion);
 
-        gconf_client = dh_base_get_gconf_client (dh_base_get ());
-        gconf_client_notify_remove (gconf_client, priv->advanced_options_id);
-
         G_OBJECT_CLASS (dh_search_parent_class)->finalize (object);
 }
 
@@ -142,8 +125,6 @@
 {
         DhSearchPriv *priv = GET_PRIVATE (search);
 
-        priv->entry_str = g_string_new ("");
-
         priv->completion = g_completion_new (
                 (GCompletionFunc) search_complete_func);
 
@@ -159,40 +140,6 @@
 }
 
 static void
-search_advanced_options_setup (DhSearch *search)
-{
-        DhSearchPriv *priv = GET_PRIVATE (search);
-        gboolean      advanced_options;
-        GConfClient  *gconf_client;
-
-        gconf_client = dh_base_get_gconf_client (dh_base_get ());
-
-        advanced_options = gconf_client_get_bool (gconf_client,
-                                                  GCONF_ADVANCED_OPTIONS,
-                                                  NULL);
-        if (1 || advanced_options) {
-                gtk_widget_show (priv->advanced_box);
-        } else {
-                gtk_widget_hide (priv->advanced_box);
-        }
-}
-
-static void
-search_advanced_options_notify_cb (GConfClient *client,
-                                   guint        cnxn_id,
-                                   GConfEntry  *entry,
-                                   gpointer     user_data)
-{
-        DhSearch     *search = user_data;
-        DhSearchPriv *priv = GET_PRIVATE (search);
-
-        search_advanced_options_setup (search);
-
-        /* Simulate a new search to update. */
-        search_entry_activated_cb (GTK_ENTRY (priv->entry), search);
-}
-
-static void
 search_selection_changed_cb (GtkTreeSelection *selection,
                              DhSearch         *search)
 {
@@ -317,7 +264,7 @@
                                          search_combo_changed_cb,
                                          search);
 
-        if (book_id != NULL && GTK_WIDGET_VISIBLE (priv->advanced_box)) {
+        if (book_id != NULL) {
                 model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->book_combo));
 
                 has_next = gtk_tree_model_get_iter_first (model, &iter);
@@ -357,10 +304,6 @@
         GtkTreeModel *model;
         gchar        *id;
 
-        if (!GTK_WIDGET_VISIBLE (priv->advanced_box)) {
-                return NULL;
-        }
-
         if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->book_combo),
                                             &iter)) {
                 return NULL;
@@ -413,11 +356,7 @@
         const gchar  *str;
         DhLink       *link;
 
-        if (GTK_WIDGET_VISIBLE (priv->advanced_box)) {
-                id = search_combo_get_active_id (search);
-        } else {
-                id = NULL;
-        }
+        id = search_combo_get_active_id (search);
         str = gtk_entry_get_text (GTK_ENTRY (priv->entry));
         link = dh_keyword_model_filter (priv->model, str, id);
         g_free (id);
@@ -476,11 +415,7 @@
         d(g_print ("Filter idle\n"));
 
         str = gtk_entry_get_text (GTK_ENTRY (priv->entry));
-        if (GTK_WIDGET_VISIBLE (priv->advanced_box)) {
-                id = search_combo_get_active_id (search);
-        } else {
-                id = NULL;
-        }
+        id = search_combo_get_active_id (search);
         link = dh_keyword_model_filter (priv->model, str, id);
         g_free (id);
 
@@ -592,7 +527,6 @@
         GtkWidget        *hbox;
         GtkWidget        *book_label;
         GtkCellRenderer  *cell;
-        GConfClient      *gconf_client;
 
         search = g_object_new (DH_TYPE_SEARCH, NULL);
 
@@ -608,18 +542,12 @@
         book_label = gtk_label_new_with_mnemonic (_("_Book:"));
         gtk_label_set_mnemonic_widget (GTK_LABEL (book_label), priv->book_combo);
 
-        priv->advanced_box = gtk_vbox_new (FALSE, 2);
-        gtk_box_pack_start (GTK_BOX (search), priv->advanced_box, FALSE, FALSE, 0);
-
         hbox = gtk_hbox_new (FALSE, 6);
         gtk_box_pack_start (GTK_BOX (hbox), book_label, FALSE, FALSE, 0);
         gtk_box_pack_start (GTK_BOX (hbox), priv->book_combo, TRUE, TRUE, 0);
-        gtk_box_pack_start (GTK_BOX (priv->advanced_box), hbox, FALSE, FALSE, 0);
+        gtk_box_pack_start (GTK_BOX (search), hbox, FALSE, FALSE, 0);
 
-        gtk_widget_show_all (priv->advanced_box);
-        gtk_widget_set_no_show_all (priv->advanced_box, TRUE);
-
-        /* Setup the keyword box */
+        /* Setup the keyword box. */
         priv->entry = gtk_entry_new ();
         g_signal_connect (priv->entry, "key_press_event",
                           G_CALLBACK (search_entry_key_press_event_cb),
@@ -687,14 +615,6 @@
 
         gtk_widget_show_all (GTK_WIDGET (search));
 
-        gconf_client = dh_base_get_gconf_client (dh_base_get ());
-        priv->advanced_options_id = gconf_client_notify_add (gconf_client,
-                                                             GCONF_ADVANCED_OPTIONS,
-                                                             search_advanced_options_notify_cb,
-                                                             search, NULL, NULL);
-
-        search_advanced_options_setup (search);
-
         return GTK_WIDGET (search);
 }
 
@@ -709,14 +629,11 @@
 
         priv = GET_PRIVATE (search);
 
-        g_string_set_size (priv->entry_str, 0);
-        g_string_append (priv->entry_str, str);
-
         g_signal_handlers_block_by_func (priv->entry,
                                          search_entry_changed_cb,
                                          search);
 
-        gtk_entry_set_text (GTK_ENTRY (priv->entry), priv->entry_str->str);
+        gtk_entry_set_text (GTK_ENTRY (priv->entry), str);
 
         gtk_editable_set_position (GTK_EDITABLE (priv->entry), -1);
         gtk_editable_select_region (GTK_EDITABLE (priv->entry), -1, -1);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]