gimp r26861 - in trunk: . app/dialogs app/widgets



Author: mitch
Date: Thu Sep  4 14:28:00 2008
New Revision: 26861
URL: http://svn.gnome.org/viewvc/gimp?rev=26861&view=rev

Log:
2008-09-04  Michael Natterer  <mitch gimp org>

	* app/widgets/gimpactionview.[ch]: add a column for the casefold
	label of the action and filter on that.

	* app/dialogs/keyboard-shortcuts-dialog.c: add a button to clear
	the filter entry. Changed the label to "Search:".



Modified:
   trunk/ChangeLog
   trunk/app/dialogs/keyboard-shortcuts-dialog.c
   trunk/app/widgets/gimpactionview.c
   trunk/app/widgets/gimpactionview.h

Modified: trunk/app/dialogs/keyboard-shortcuts-dialog.c
==============================================================================
--- trunk/app/dialogs/keyboard-shortcuts-dialog.c	(original)
+++ trunk/app/dialogs/keyboard-shortcuts-dialog.c	Thu Sep  4 14:28:00 2008
@@ -36,6 +36,13 @@
 
 
 static void
+keyboard_shortcuts_dialog_filter_clear (GtkButton *button,
+                                        GtkEntry  *entry)
+{
+  gtk_entry_set_text (entry, "");
+}
+
+static void
 keyboard_shortcuts_dialog_filter_changed (GtkEntry       *entry,
                                           GimpActionView *view)
 {
@@ -50,10 +57,11 @@
   GtkWidget *hbox;
   GtkWidget *label;
   GtkWidget *entry;
+  GtkWidget *button;
+  GtkWidget *image;
   GtkWidget *scrolled_window;
   GtkWidget *view;
   GtkWidget *box;
-  GtkWidget *button;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
 
@@ -80,7 +88,7 @@
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
   gtk_widget_show (hbox);
 
-  label = gtk_label_new_with_mnemonic (_("_Filter:"));
+  label = gtk_label_new_with_mnemonic (_("_Search:"));
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
   gtk_widget_show (label);
 
@@ -90,6 +98,20 @@
 
   gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
 
+  button = gtk_button_new ();
+  GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
+  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+  gtk_widget_show (button);
+
+  image = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
+  gtk_container_add (GTK_CONTAINER (button), image);
+  gtk_widget_show (image);
+
+  g_signal_connect (button, "clicked",
+                    G_CALLBACK (keyboard_shortcuts_dialog_filter_clear),
+                    entry);
+
   scrolled_window = gtk_scrolled_window_new (NULL, NULL);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);

Modified: trunk/app/widgets/gimpactionview.c
==============================================================================
--- trunk/app/widgets/gimpactionview.c	(original)
+++ trunk/app/widgets/gimpactionview.c	Thu Sep  4 14:28:00 2008
@@ -204,14 +204,15 @@
   g_return_val_if_fail (GIMP_IS_UI_MANAGER (manager), NULL);
 
   store = gtk_tree_store_new (GIMP_ACTION_VIEW_NUM_COLUMNS,
-                              G_TYPE_BOOLEAN,         /* COLUMN_VISIBLE       */
-                              GTK_TYPE_ACTION,        /* COLUMN_ACTION        */
-                              G_TYPE_STRING,          /* COLUMN_STOCK_ID      */
-                              G_TYPE_STRING,          /* COLUMN_LABEL         */
-                              G_TYPE_STRING,          /* COLUMN_NAME          */
-                              G_TYPE_UINT,            /* COLUMN_ACCEL_KEY     */
-                              GDK_TYPE_MODIFIER_TYPE, /* COLUMN_ACCEL_MASK    */
-                              G_TYPE_CLOSURE);        /* COLUMN_ACCEL_CLOSURE */
+                              G_TYPE_BOOLEAN,         /* COLUMN_VISIBLE        */
+                              GTK_TYPE_ACTION,        /* COLUMN_ACTION         */
+                              G_TYPE_STRING,          /* COLUMN_STOCK_ID       */
+                              G_TYPE_STRING,          /* COLUMN_LABEL          */
+                              G_TYPE_STRING,          /* COLUMN_LABEL_CASEFOLD */
+                              G_TYPE_STRING,          /* COLUMN_NAME           */
+                              G_TYPE_UINT,            /* COLUMN_ACCEL_KEY      */
+                              GDK_TYPE_MODIFIER_TYPE, /* COLUMN_ACCEL_MASK     */
+                              G_TYPE_CLOSURE);        /* COLUMN_ACCEL_CLOSURE  */
 
   accel_group = gtk_ui_manager_get_accel_group (GTK_UI_MANAGER (manager));
 
@@ -241,6 +242,7 @@
           const gchar     *name          = gtk_action_get_name (action);
           gchar           *stock_id;
           gchar           *label;
+          gchar           *label_casefold;
           gchar           *tmp;
           guint            accel_key     = 0;
           GdkModifierType  accel_mask    = 0;
@@ -266,6 +268,8 @@
               label = g_strdup (name);
             }
 
+          label_casefold = g_utf8_casefold (label, -1);
+
           if (show_shortcuts)
             {
               accel_closure = gtk_action_get_accel_closure (action);
@@ -291,18 +295,20 @@
           gtk_tree_store_append (store, &action_iter, &group_iter);
 
           gtk_tree_store_set (store, &action_iter,
-                              GIMP_ACTION_VIEW_COLUMN_VISIBLE,       TRUE,
-                              GIMP_ACTION_VIEW_COLUMN_ACTION,        action,
-                              GIMP_ACTION_VIEW_COLUMN_STOCK_ID,      stock_id,
-                              GIMP_ACTION_VIEW_COLUMN_LABEL,         label,
-                              GIMP_ACTION_VIEW_COLUMN_NAME,          name,
-                              GIMP_ACTION_VIEW_COLUMN_ACCEL_KEY,     accel_key,
-                              GIMP_ACTION_VIEW_COLUMN_ACCEL_MASK,    accel_mask,
-                              GIMP_ACTION_VIEW_COLUMN_ACCEL_CLOSURE, accel_closure,
+                              GIMP_ACTION_VIEW_COLUMN_VISIBLE,        TRUE,
+                              GIMP_ACTION_VIEW_COLUMN_ACTION,         action,
+                              GIMP_ACTION_VIEW_COLUMN_STOCK_ID,       stock_id,
+                              GIMP_ACTION_VIEW_COLUMN_LABEL,          label,
+                              GIMP_ACTION_VIEW_COLUMN_LABEL_CASEFOLD, label_casefold,
+                              GIMP_ACTION_VIEW_COLUMN_NAME,           name,
+                              GIMP_ACTION_VIEW_COLUMN_ACCEL_KEY,      accel_key,
+                              GIMP_ACTION_VIEW_COLUMN_ACCEL_MASK,     accel_mask,
+                              GIMP_ACTION_VIEW_COLUMN_ACCEL_CLOSURE,  accel_closure,
                               -1);
 
           g_free (stock_id);
           g_free (label);
+          g_free (label_casefold);
 
           if (select_action && ! strcmp (select_action, name))
             {
@@ -439,7 +445,10 @@
     filter = NULL;
 
   g_free (view->filter);
-  view->filter = g_strdup (filter);
+  view->filter = NULL;
+
+  if (filter)
+    view->filter = g_utf8_casefold (filter, -1);
 
   for (iter_valid = gtk_tree_model_get_iter_first (model, &iter);
        iter_valid;
@@ -462,12 +471,12 @@
               gchar *name;
 
               gtk_tree_model_get (model, &child_iter,
-                                  GIMP_ACTION_VIEW_COLUMN_LABEL, &label,
-                                  GIMP_ACTION_VIEW_COLUMN_NAME,  &name,
+                                  GIMP_ACTION_VIEW_COLUMN_LABEL_CASEFOLD, &label,
+                                  GIMP_ACTION_VIEW_COLUMN_NAME,           &name,
                                   -1);
 
-              visible = (strstr (label, view->filter) != NULL ||
-                         strstr (name,  view->filter) != NULL);
+              visible = label && name && (strstr (label, view->filter) != NULL ||
+                                          strstr (name,  view->filter) != NULL);
 
               g_free (label);
               g_free (name);

Modified: trunk/app/widgets/gimpactionview.h
==============================================================================
--- trunk/app/widgets/gimpactionview.h	(original)
+++ trunk/app/widgets/gimpactionview.h	Thu Sep  4 14:28:00 2008
@@ -29,6 +29,7 @@
   GIMP_ACTION_VIEW_COLUMN_ACTION,
   GIMP_ACTION_VIEW_COLUMN_STOCK_ID,
   GIMP_ACTION_VIEW_COLUMN_LABEL,
+  GIMP_ACTION_VIEW_COLUMN_LABEL_CASEFOLD,
   GIMP_ACTION_VIEW_COLUMN_NAME,
   GIMP_ACTION_VIEW_COLUMN_ACCEL_KEY,
   GIMP_ACTION_VIEW_COLUMN_ACCEL_MASK,



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