mirror of https://github.com/GNOME/gimp.git
add a column for the casefold label of the action and filter on that.
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:". svn path=/trunk/; revision=26861
This commit is contained in:
parent
625049ab69
commit
4bbc40b732
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,11 @@
|
|||
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:".
|
||||
|
||||
2008-09-04 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/gfig/gfig-dobject.h
|
||||
|
@ -5,7 +13,7 @@
|
|||
|
||||
2008-09-04 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpactionview.[ch]: add n GtkTreeModelFilter
|
||||
* app/widgets/gimpactionview.[ch]: add a GtkTreeModelFilter
|
||||
between the GtkTreeView and the actual GtkTreeStore. Add API to
|
||||
set the filter which is simply a string that's matched with
|
||||
strstr(). Quite some things improvable here...
|
||||
|
|
|
@ -35,6 +35,13 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
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 @@ keyboard_shortcuts_dialog_new (Gimp *gimp)
|
|||
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 @@ keyboard_shortcuts_dialog_new (Gimp *gimp)
|
|||
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 @@ keyboard_shortcuts_dialog_new (Gimp *gimp)
|
|||
|
||||
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);
|
||||
|
|
|
@ -204,14 +204,15 @@ gimp_action_view_new (GimpUIManager *manager,
|
|||
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 @@ gimp_action_view_new (GimpUIManager *manager,
|
|||
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 @@ gimp_action_view_new (GimpUIManager *manager,
|
|||
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 @@ gimp_action_view_new (GimpUIManager *manager,
|
|||
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 @@ gimp_action_view_set_filter (GimpActionView *view,
|
|||
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 @@ gimp_action_view_set_filter (GimpActionView *view,
|
|||
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);
|
||||
|
|
|
@ -29,6 +29,7 @@ enum
|
|||
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,
|
||||
|
|
Loading…
Reference in New Issue