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

gEDA-cvs: pcb.git: branch: master updated (4e241279907be0bc3d7753fb6d499b8551a13cda)



The branch, master has been updated
       via  4e241279907be0bc3d7753fb6d499b8551a13cda (commit)
       via  f71dc448e8f68dc8f97b303918737aedc907da45 (commit)
      from  df91527ba7530fdf5b6bf0d2d398ac799bb0e1ec (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 |   35 +++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 4 deletions(-)


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

commit 4e241279907be0bc3d7753fb6d499b8551a13cda
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    gtk: allow route style selector to have nothing selected
    
    The affects the the function ghid_route_style_selector_sync() function,
    which is called from the RouteStylesChanged action to keep the GUI in
    sync with pcb's state. It selects the route style that matches pcb's
    state, or if none exists, does nothing.
    
    This patch replaces "does nothing" with "deselects all styles", so that
    the GUI will not be misleading.
    
    Closes-bug: lp-699299

:100644 100644 27808e5... 01f2a96... M	src/hid/gtk/ghid-route-style-selector.c

commit f71dc448e8f68dc8f97b303918737aedc907da45
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    gtk: fix memory leak in route style selector
    
    When the route style selector is emptied (e.g., when new styles
    are loaded from a .pcb file), any route style data not owned by
    pcb core is freed. However, this did not apply to all temporary
    route style data, even though the pcb core is completely unaware
    of those.
    
    This commit frees all temporary route style data.

:100644 100644 2da8160... 27808e5... M	src/hid/gtk/ghid-route-style-selector.c

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

commit 4e241279907be0bc3d7753fb6d499b8551a13cda
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    gtk: allow route style selector to have nothing selected
    
    The affects the the function ghid_route_style_selector_sync() function,
    which is called from the RouteStylesChanged action to keep the GUI in
    sync with pcb's state. It selects the route style that matches pcb's
    state, or if none exists, does nothing.
    
    This patch replaces "does nothing" with "deselects all styles", so that
    the GUI will not be misleading.
    
    Closes-bug: lp-699299

diff --git a/src/hid/gtk/ghid-route-style-selector.c b/src/hid/gtk/ghid-route-style-selector.c
index 27808e5..01f2a96 100644
--- a/src/hid/gtk/ghid-route-style-selector.c
+++ b/src/hid/gtk/ghid-route-style-selector.c
@@ -52,6 +52,8 @@ struct _GHidRouteStyleSelector
 
   GtkActionGroup *action_group;
   GtkAccelGroup *accel_group;
+  GtkRadioAction *null_action;
+  GtkWidget *null_button;
   gint shortcut_key_idx;
 
   GtkListStore *model;
@@ -77,6 +79,17 @@ struct _route_style
   gulong sig_id;
 };
 
+static void
+init_radio_groups (GHidRouteStyleSelector *rss)
+{
+  gtk_radio_action_set_group (rss->null_action, rss->action_radio_group);
+  rss->action_radio_group = gtk_radio_action_get_group (rss->null_action);
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (rss->null_button),
+                              rss->button_radio_group);
+  rss->button_radio_group = gtk_radio_button_get_group
+                              (GTK_RADIO_BUTTON (rss->null_button));
+}
+
 /* SIGNAL HANDLERS */
 /*! \brief Callback for user selection of a route style */
 static void
@@ -392,6 +405,12 @@ ghid_route_style_selector_new ()
 
   rss->accel_group = gtk_accel_group_new ();
   rss->action_group = gtk_action_group_new ("RouteStyleSelector");
+  rss->null_action = gtk_radio_action_new ("RouteStyleXX", "",
+                                           NULL, NULL, -1);
+  rss->null_button = gtk_radio_button_new (rss->button_radio_group);
+  init_radio_groups (rss);
+  gtk_activatable_set_related_action (GTK_ACTIVATABLE (rss->null_button),
+                                      GTK_ACTION (rss->null_action));
   rss->shortcut_key_idx = 1;
 
   /* Create edit button */
@@ -587,6 +606,7 @@ ghid_route_style_selector_sync (GHidRouteStyleSelector *rss,
                                 Coord Thick, Coord Hole,
                                 Coord Diameter, Coord Keepaway)
 {
+  gboolean found_match = FALSE;
   GtkTreeIter iter;
   gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rss->model), &iter);
   do
@@ -604,9 +624,13 @@ ghid_route_style_selector_sync (GHidRouteStyleSelector *rss,
             (GTK_TOGGLE_ACTION (style->action), TRUE);
           g_signal_handler_unblock (G_OBJECT (style->action), style->sig_id);
           rss->active_style = style;
+          found_match = TRUE;
         }
     }
   while (gtk_tree_model_iter_next (GTK_TREE_MODEL (rss->model), &iter));
+
+  if (!found_match)
+    gtk_radio_action_set_current_value (rss->null_action, -1);
 }
 
 /*! \brief Removes all styles from a route style selector */
@@ -642,5 +666,6 @@ ghid_route_style_selector_empty (GHidRouteStyleSelector *rss)
   rss->action_radio_group = NULL;
   rss->button_radio_group = NULL;
   rss->shortcut_key_idx = 1;
+  init_radio_groups (rss);
 }
 

commit f71dc448e8f68dc8f97b303918737aedc907da45
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    gtk: fix memory leak in route style selector
    
    When the route style selector is emptied (e.g., when new styles
    are loaded from a .pcb file), any route style data not owned by
    pcb core is freed. However, this did not apply to all temporary
    route style data, even though the pcb core is completely unaware
    of those.
    
    This commit frees all temporary route style data.

diff --git a/src/hid/gtk/ghid-route-style-selector.c b/src/hid/gtk/ghid-route-style-selector.c
index 2da8160..27808e5 100644
--- a/src/hid/gtk/ghid-route-style-selector.c
+++ b/src/hid/gtk/ghid-route-style-selector.c
@@ -68,7 +68,7 @@ struct _GHidRouteStyleSelectorClass
 
 struct _route_style
 {
-  gboolean temporary;   /* TODO: actually use this for something */
+  gboolean temporary;
   GtkRadioAction *action;
   GtkWidget *button;
   GtkWidget *menu_item;
@@ -622,9 +622,6 @@ 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));
@@ -633,6 +630,11 @@ ghid_route_style_selector_empty (GHidRouteStyleSelector *rss)
         gtk_widget_destroy (GTK_WIDGET (rsdata->button));
       if (rsdata->menu_item)
         gtk_widget_destroy (GTK_WIDGET (rsdata->menu_item));
+      if (rsdata->temporary)
+        {
+          free (rsdata->rst->Name);
+          g_free (rsdata->rst);
+        }
       gtk_tree_row_reference_free (rsdata->rref);
       free (rsdata);
     }




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