<p>The reason the <code>activate</code> callback isn't called is because the handler connected to the menu's <code>show</code> is called once when the doclist menu is shown and once when it's hidden. In that handler, it clears the menu menu before adding current documents, but since it's after the menu is selected but before the <code>activate</code> handlers are run, and it deletes all the items, the handlers are never called.</p>

<p>It can be witnessed by using this completely silly work-around which ensures the <code>show</code> signal handler is only run every other time (just the "shows" not the "hides"):</p>

<div class="highlight highlight-source-c"><pre>diff --git a/plugins/splitwindow.c b/plugins/splitwindow.c
index 4f0dec3..e2f1240 <span class="pl-c1">100644</span>
--- a/plugins/splitwindow.c
+++ b/plugins/splitwindow.c
@@ -<span class="pl-c1">249</span>,<span class="pl-c1">11</span> +<span class="pl-c1">249</span>,<span class="pl-c1">22</span> @@ <span class="pl-k">static</span> <span class="pl-k">void</span> <span class="pl-en">on_doc_menu_item_clicked</span>(gpointer item, GeanyDocument *doc)

 static void on_doc_menu_show(GtkMenu *menu)
 {
-   <span class="pl-c">/* clear the old menu items */</span>
-   <span class="pl-c1">gtk_container_foreach</span>(<span class="pl-c1">GTK_CONTAINER</span>(menu), (GtkCallback) gtk_widget_destroy, <span class="pl-c1">NULL</span>);
+   <span class="pl-k">static</span> gboolean toggle = <span class="pl-c1">FALSE</span>;

-   <span class="pl-c1">ui_menu_add_document_items</span>(menu, edit_window.<span class="pl-smi">editor</span>->document,
-       <span class="pl-c1">G_CALLBACK</span>(on_doc_menu_item_clicked));
+   <span class="pl-k">if</span> (!toggle)
+   {
+       <span class="pl-c">/* clear the old menu items */</span>
+       <span class="pl-c1">gtk_container_foreach</span>(<span class="pl-c1">GTK_CONTAINER</span>(menu), (GtkCallback) gtk_widget_destroy, <span class="pl-c1">NULL</span>);
+
+       <span class="pl-c1">ui_menu_add_document_items</span>(menu, edit_window.<span class="pl-smi">editor</span>->document,
+           <span class="pl-c1">G_CALLBACK</span>(on_doc_menu_item_clicked));
+
+       toggle = <span class="pl-c1">TRUE</span>;
+   }
+   <span class="pl-k">else</span>
+   {
+       toggle = <span class="pl-c1">FALSE</span>;
+   }
 }</pre></div>

<p>It might be a GTK+ bug?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/1149#issuecomment-234845602">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABDrJ37CTz45-0LkGtXQUNlu6PskU1Ksks5qZE1OgaJpZM4JTxOO">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJx8ocO-Ve1u6e5zlitGv8jFH2_3Oks5qZE1OgaJpZM4JTxOO.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/issues/1149#issuecomment-234845602"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>