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

gEDA-cvs: pcb.git: branch: master updated (482ee796928af45b643a289670b9945c3b5c2743)



The branch, master has been updated
       via  482ee796928af45b643a289670b9945c3b5c2743 (commit)
      from  f290499bd7d5570727721326de1b7f59b6af2d07 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 src/hid/gtk/ghid-route-style-selector.c |   14 +++++++++++---
 src/hid/gtk/gui-top-window.c            |    3 +++
 2 files changed, 14 insertions(+), 3 deletions(-)


=================
 Commit Messages
=================

commit 482ee796928af45b643a289670b9945c3b5c2743
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    gtk: fix route style selector accelerators
    
    When the route-style list is changed, the menu items are not
    updated properly. (In fact, they come out of sync and point
    to invalid memory and lose their accelerators.)
    
    This commit fixes all that.

:100644 100644 6c5e26f... 2da8160... M	src/hid/gtk/ghid-route-style-selector.c
:100644 100644 ee79f1a... e876220... M	src/hid/gtk/gui-top-window.c

=========
 Changes
=========

commit 482ee796928af45b643a289670b9945c3b5c2743
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    gtk: fix route style selector accelerators
    
    When the route-style list is changed, the menu items are not
    updated properly. (In fact, they come out of sync and point
    to invalid memory and lose their accelerators.)
    
    This commit fixes all that.

diff --git a/src/hid/gtk/ghid-route-style-selector.c b/src/hid/gtk/ghid-route-style-selector.c
index 6c5e26f..2da8160 100644
--- a/src/hid/gtk/ghid-route-style-selector.c
+++ b/src/hid/gtk/ghid-route-style-selector.c
@@ -52,6 +52,7 @@ struct _GHidRouteStyleSelector
 
   GtkActionGroup *action_group;
   GtkAccelGroup *accel_group;
+  gint shortcut_key_idx;
 
   GtkListStore *model;
   struct _route_style *active_style;
@@ -391,6 +392,7 @@ ghid_route_style_selector_new ()
 
   rss->accel_group = gtk_accel_group_new ();
   rss->action_group = gtk_action_group_new ("RouteStyleSelector");
+  rss->shortcut_key_idx = 1;
 
   /* Create edit button */
   rss->edit_button = gtk_button_new_with_label (_("Route Styles"));
@@ -439,15 +441,16 @@ ghid_route_style_selector_real_add_route_style (GHidRouteStyleSelector *rss,
   gtk_tree_path_free (path);
 
   /* Setup accelerator */
-  if (action_count < 12)
+  if (rss->shortcut_key_idx < 12)
     {
-      gchar *accel = g_strdup_printf ("<Ctrl>F%d", action_count + 1);
+      gchar *accel = g_strdup_printf ("<Ctrl>F%d", rss->shortcut_key_idx);
       gtk_action_set_accel_group (GTK_ACTION (new_style->action),
                                   rss->accel_group);
       gtk_action_group_add_action_with_accel (rss->action_group,
                                               GTK_ACTION (new_style->action),
                                               accel);
       g_free (accel);
+      ++rss->shortcut_key_idx;
     }
 
   /* Hookup and install radio button */
@@ -619,18 +622,23 @@ ghid_route_style_selector_empty (GHidRouteStyleSelector *rss)
                           &iter, DATA_COL, &rsdata, -1);
       if (rsdata->action)
         {
+#if 0
           gtk_action_disconnect_accelerator (GTK_ACTION (rsdata->action));
+#endif
           gtk_action_group_remove_action (rss->action_group,
                                 GTK_ACTION (rsdata->action));
           g_object_unref (G_OBJECT (rsdata->action));
         }
       if (rsdata->button)
-        gtk_widget_destroy (GTK_WIDGET (rsdata->button));;
+        gtk_widget_destroy (GTK_WIDGET (rsdata->button));
+      if (rsdata->menu_item)
+        gtk_widget_destroy (GTK_WIDGET (rsdata->menu_item));
       gtk_tree_row_reference_free (rsdata->rref);
       free (rsdata);
     }
   while (gtk_list_store_remove (rss->model, &iter));
   rss->action_radio_group = NULL;
   rss->button_radio_group = NULL;
+  rss->shortcut_key_idx = 1;
 }
 
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index ee79f1a..e876220 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -931,6 +931,9 @@ make_route_style_buttons (GHidRouteStyleSelector *rss)
                     G_CALLBACK (route_style_changed_cb), NULL);
   g_signal_connect (G_OBJECT (rss), "style_edited",
                     G_CALLBACK (route_styles_edited_cb), NULL);
+  ghid_main_menu_install_route_style_selector
+      (GHID_MAIN_MENU (ghidgui->menu_bar),
+       GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector));
 }
 
 /*




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs