Skip to content

Commit

Permalink
Use :select/:deselect signals for consistency
Browse files Browse the repository at this point in the history
Instead of having a handler on 2 separate objects, use :select and
:deselect on the same one.  Those signals are appropriate, as the
documentation mentions that submenus are popped up on :select.
  • Loading branch information
b4n committed Feb 5, 2017
1 parent 67d6562 commit 2c1a71a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions data/geany.glade
Original file line number Diff line number Diff line change
Expand Up @@ -6321,7 +6321,6 @@
<object class="GtkMenuBar" id="menubar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="deactivate" handler="on_menubar1_deactivate" after="yes" swapped="no"/>
<child>
<object class="GtkMenuItem" id="file1">
<property name="visible">True</property>
Expand Down Expand Up @@ -6563,7 +6562,8 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_edit1_activate" swapped="no"/>
<signal name="select" handler="on_edit1_select" swapped="no"/>
<signal name="deselect" handler="on_edit1_deselect" swapped="no"/>
<child type="submenu">
<object class="GtkMenu" id="edit1_menu">
<property name="can_focus">False</property>
Expand Down
6 changes: 3 additions & 3 deletions src/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data)


/* edit actions, c&p & co, from menu bar and from popup menu */
static void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data)
static void on_edit1_select(GtkMenuItem *menuitem, gpointer user_data)
{
GtkWidget *item;
GeanyDocument *doc = document_get_current();
Expand All @@ -200,9 +200,9 @@ static void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data)
}


static void on_menubar1_deactivate(GtkMenuShell *menushell, gpointer user_data)
static void on_edit1_deselect(GtkMenuShell *menushell, gpointer user_data)
{
/* we re-enable items that were disabled in on_edit1_activate() on menu popdown to
/* we re-enable items that were disabled in on_edit1_select() on menu popdown to
* workaround mutli-layout keyboard issues in our keybinding handling code, so that
* GTK's accelerator handling can catch them.
* See https://github.com/geany/geany/issues/1368#issuecomment-273678207 */
Expand Down

0 comments on commit 2c1a71a

Please sign in to comment.