Re: [gthumb-list] "hotkey unwork" bugs





Paolo Bacchilega a écrit :
Matthias Hawran ha scritto:
Hi all,

I'm looking at the 18 "hotkey unwork" bugs (#575036 and on)
which basically address the same issue:
the mnemonic is not always set or half set.

Some are easy to fix, in glade you just need to set the "Mnemonic
widget"
in the label general properties tab, which adds the following line:
<property name="mnemonic_widget">xxxx</property>

However when the widget is a Box, like a GtkHBox for example it's not so
straightforward.

As an example, let's take *Bug 575036*
<https://bugzilla.gnome.org/show_bug.cgi?id=575036>
It's in the search function.
Alt+a, for the "Start at" widget doesn't work.
You would naturally set the mnemonic widget to "location_box", except
it's a GtkHBox.
Which gives you the following execution warning:

(gthumb:8205): Gtk-WARNING **: widget `GtkHBox' isn't suitable for
mnemonic activation

In the same part, I then looked at how the "Match" mnemonic worked,
since the glade had no "mnemonic_widget" property.
It's done in the code with the "gtk_label_set_mnemonic_widget" function

extensions/search/gth-search-editor.c:148
gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET ("match_label")),
self->priv->match_type_combobox);

Ok so let's do this for the "Start at":

gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET
("start_at_label")), self->priv->location_chooser);

Not better, I get:

(gthumb:9007): Gtk-WARNING **: widget `GthLocationChooser' isn't
suitable for mnemonic activation

  

ok, I'll look into this

And now I'm stuck :-)

But maybe there's no solution to get a mnemonic for such case ?
In that case we should remove the "use underline" property,
which makes you think there is one.

I'll fix all the others I can and prepare a global patch for all the
bugs,
what do you think (of the global patch idea) ?
  

I'm fine with the global patch

Thanks for reading so far.

Cheers,
Matthias
  

- Paolo



I saw your fix for Bug 575036.
I'll be able to continue with the rest.
I won't do a global patch, but intermediate patches.
I'll attach them here, since they'll cover several bug reports.

Here's the one for
- metadata dialog (bug 575037)
- import pref dialog (bug 575048)
- photo importer dialog (bug 575050)

Let me know if it's ok, so I can continue.

Cheers,
Matthias



From 9e57c9db4f5eb0d61d26dd0ee9c15dc382d7d17e Mon Sep 17 00:00:00 2001
From: Matthias Hawran <matthias hawran net>
Date: Thu, 25 Feb 2010 18:39:50 +0100
Subject: [PATCH] Several mnemonic fixes (bug 575037, bug 575048, bug 575050)

---
 .../edit_metadata/data/ui/edit-comment-page.ui     |   10 ++++++----
 extensions/edit_metadata/gth-edit-comment-page.c   |    2 ++
 extensions/importer/data/ui/import-preferences.ui  |   10 ++++++----
 .../photo_importer/data/ui/photo-importer.ui       |    3 ++-
 gthumb/gth-tags-entry.c                            |   17 ++++++++++++++++-
 5 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/extensions/edit_metadata/data/ui/edit-comment-page.ui 
b/extensions/edit_metadata/data/ui/edit-comment-page.ui
index d72ed60..1e1f073 100644
--- a/extensions/edit_metadata/data/ui/edit-comment-page.ui
+++ b/extensions/edit_metadata/data/ui/edit-comment-page.ui
@@ -15,14 +15,14 @@
         <property name="yalign">0</property>
         <property name="label" translatable="yes">D_escription:</property>
         <property name="use_underline">True</property>
-        <property name="mnemonic_widget">scrolledwindow3</property>
+        <property name="mnemonic_widget">note_text</property>
       </object>
       <packing>
         <property name="x_options">GTK_FILL</property>
       </packing>
     </child>
     <child>
-      <object class="GtkLabel" id="label13">
+      <object class="GtkLabel" id="date_label">
         <property name="visible">True</property>
         <property name="xalign">0</property>
         <property name="label" translatable="yes">_Date:</property>
@@ -110,11 +110,11 @@
         <property name="visible">True</property>
         <property name="top_padding">2</property>
         <child>
-          <object class="GtkLabel" id="label1">
+          <object class="GtkLabel" id="tags_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
             <property name="yalign">0</property>
-            <property name="label" translatable="yes">_Tags:</property>
+            <property name="label" translatable="yes">T_ags:</property>
             <property name="use_underline">True</property>
           </object>
         </child>
@@ -194,6 +194,7 @@
         <property name="yalign">0.60000002384185791</property>
         <property name="label" translatable="yes">_Rating:</property>
         <property name="use_underline">True</property>
+        <property name="mnemonic_widget">rating_spinbutton</property>
       </object>
       <packing>
         <property name="top_attach">5</property>
@@ -223,6 +224,7 @@
         <property name="yalign">0.60000002384185791</property>
         <property name="label" translatable="yes">_Title:</property>
         <property name="use_underline">True</property>
+        <property name="mnemonic_widget">title_entry</property>
       </object>
       <packing>
         <property name="top_attach">1</property>
diff --git a/extensions/edit_metadata/gth-edit-comment-page.c 
b/extensions/edit_metadata/gth-edit-comment-page.c
index 90a8342..2f75334 100644
--- a/extensions/edit_metadata/gth-edit-comment-page.c
+++ b/extensions/edit_metadata/gth-edit-comment-page.c
@@ -407,10 +407,12 @@ gth_edit_comment_page_init (GthEditCommentPage *self)
        self->priv->date_selector = gth_time_selector_new ();
        gtk_widget_show (self->priv->date_selector);
        gtk_box_pack_start (GTK_BOX (GET_WIDGET ("date_selector_container")), self->priv->date_selector, 
FALSE, FALSE, 0);
+       gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET ("date_label")), self->priv->date_combobox);
 
        self->priv->tags_entry = gth_tags_entry_new ();
        gtk_widget_show (self->priv->tags_entry);
        gtk_box_pack_start (GTK_BOX (GET_WIDGET ("tags_entry_container")), self->priv->tags_entry, FALSE, 
FALSE, 0);
+       gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET ("tags_label")), self->priv->tags_entry);
 }
 
 
diff --git a/extensions/importer/data/ui/import-preferences.ui 
b/extensions/importer/data/ui/import-preferences.ui
index 6836ed1..2eb912a 100644
--- a/extensions/importer/data/ui/import-preferences.ui
+++ b/extensions/importer/data/ui/import-preferences.ui
@@ -29,9 +29,9 @@
                     <child>
                       <object class="GtkFileChooserButton" id="destination_filechooserbutton">
                         <property name="visible">True</property>
-                        <property name="create_folders">False</property>
-                        <property name="local_only">False</property>
                         <property name="action">select-folder</property>
+                        <property name="local_only">False</property>
+                        <property name="create_folders">False</property>
                       </object>
                       <packing>
                         <property name="position">0</property>
@@ -48,10 +48,12 @@
           </object>
         </child>
         <child type="label">
-          <object class="GtkLabel" id="label1">
+          <object class="GtkLabel" id="destination_label">
             <property name="visible">True</property>
-            <property name="label" translatable="yes">Destination</property>
+            <property name="label" translatable="yes">_Destination</property>
             <property name="use_markup">True</property>
+            <property name="use_underline">True</property>
+            <property name="mnemonic_widget">destination_filechooserbutton</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
diff --git a/extensions/photo_importer/data/ui/photo-importer.ui 
b/extensions/photo_importer/data/ui/photo-importer.ui
index bceb217..46fa5dd 100644
--- a/extensions/photo_importer/data/ui/photo-importer.ui
+++ b/extensions/photo_importer/data/ui/photo-importer.ui
@@ -175,11 +175,12 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkLabel" id="label4">
+                  <object class="GtkLabel" id="event_label">
                     <property name="visible">True</property>
                     <property name="xalign">0</property>
                     <property name="label" translatable="yes">_Event:</property>
                     <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">event_entry</property>
                   </object>
                   <packing>
                     <property name="x_options">GTK_FILL</property>
diff --git a/gthumb/gth-tags-entry.c b/gthumb/gth-tags-entry.c
index a5cc024..07560a5 100644
--- a/gthumb/gth-tags-entry.c
+++ b/gthumb/gth-tags-entry.c
@@ -95,15 +95,28 @@ gth_tags_entry_finalize (GObject *obj)
 
 
 static void
+gth_tags_entry_grab_focus (GtkWidget *widget)
+{
+       GthTagsEntry *entry = GTH_TAGS_ENTRY (widget);
+
+       gtk_widget_grab_focus (entry->priv->entry);
+}
+
+
+static void
 gth_tags_entry_class_init (GthTagsEntryClass *klass)
 {
-       GObjectClass *object_class;
+       GObjectClass   *object_class;
+       GtkWidgetClass *widget_class;
 
        parent_class = g_type_class_peek_parent (klass);
        g_type_class_add_private (klass, sizeof (GthTagsEntryPrivate));
 
        object_class = (GObjectClass*) (klass);
        object_class->finalize = gth_tags_entry_finalize;
+
+       widget_class = (GtkWidgetClass *) klass;
+       widget_class->grab_focus = gth_tags_entry_grab_focus;
 }
 
 
@@ -659,6 +672,8 @@ gth_tags_entry_instance_init (GthTagsEntry *self)
        GtkTreeViewColumn *column;
        GtkCellRenderer   *renderer;
 
+       GTK_WIDGET_SET_FLAGS (self, GTK_CAN_FOCUS);
+
        self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_TAGS_ENTRY, GthTagsEntryPrivate);
        self->priv->expanded_list.last_used = g_new0 (char *, 1);
 
-- 
1.6.3.3



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