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

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



The branch, master has been updated
       via  c62863b2b6e8da2c60c9a7d0d5464582563f7b58 (commit)
       via  8876712e765a81629d8437664565fedd0945ecb8 (commit)
       via  499fe7a6b88a526f6b48d671107ac3d9ec725290 (commit)
      from  9dde48253c590a80a18d4a0f12e3f90c1cfedb26 (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 |   53 +++++++++++++++++++++++++++++-
 src/hid/gtk/ghid-route-style-selector.h |    1 +
 src/hid/gtk/gtkhid-main.c               |    9 +++++
 src/hid/gtk/gui-top-window.c            |    2 +-
 src/hid/gtk/gui.h                       |    1 +
 5 files changed, 63 insertions(+), 3 deletions(-)


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

commit c62863b2b6e8da2c60c9a7d0d5464582563f7b58
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Repopulate route style selector on PCBChanged action
    
    When loading a new pcb, Bad Things happen to the route style
    selector because pcb's route style data is freed. This patch
    removes all styles from the route style selector and re-adds
    them whenever a new pcb is loaded.

:100644 100644 a855aa7... 2cb94be... M	src/hid/gtk/gtkhid-main.c
:100644 100644 97746ad... 35bdc69... M	src/hid/gtk/gui-top-window.c
:100644 100644 6de2578... dede39c... M	src/hid/gtk/gui.h

commit 8876712e765a81629d8437664565fedd0945ecb8
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Add ghid_route_style_selector_empty to GHidRouteStyleSelector

:100644 100644 e2588b2... 9f8f190... M	src/hid/gtk/ghid-route-style-selector.c
:100644 100644 53c481f... 6e934b9... M	src/hid/gtk/ghid-route-style-selector.h

commit 499fe7a6b88a526f6b48d671107ac3d9ec725290
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Add finalize function to GHidRouteStyleSelector

:100644 100644 4bc4748... e2588b2... M	src/hid/gtk/ghid-route-style-selector.c

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

commit c62863b2b6e8da2c60c9a7d0d5464582563f7b58
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Repopulate route style selector on PCBChanged action
    
    When loading a new pcb, Bad Things happen to the route style
    selector because pcb's route style data is freed. This patch
    removes all styles from the route style selector and re-adds
    them whenever a new pcb is loaded.

diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index a855aa7..2cb94be 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -1172,7 +1172,16 @@ PCBChanged (int argc, char **argv, Coord x, Coord y)
 
   if (!gport->pixmap)
     return 0;
+
+  if (ghidgui->route_style_selector)
+    {
+      ghid_route_style_selector_empty
+        (GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector));
+      make_route_style_buttons
+        (GHID_ROUTE_STYLE_SELECTOR (ghidgui->route_style_selector));
+    }
   RouteStylesChanged (0, NULL, 0, 0);
+
   ghid_port_ranges_scale ();
   ghid_zoom_view_fit ();
   ghid_sync_with_new_layout ();
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 97746ad..35bdc69 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -894,7 +894,7 @@ route_style_changed_cb (GHidRouteStyleSelector *rss, RouteStyleType *rst,
 }
 
 /*! \brief Configure the route style selector */
-static void
+void
 make_route_style_buttons (GHidRouteStyleSelector *rss)
 {
   int i;
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index 6de2578..dede39c 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -343,6 +343,7 @@ void ghid_notify_save_pcb (const char *file, bool done);
 void ghid_notify_filename_changed (void);
 void ghid_install_accel_groups (GtkWindow *window, GhidGui *gui);
 void ghid_remove_accel_groups (GtkWindow *window, GhidGui *gui);
+void make_route_style_buttons (GHidRouteStyleSelector *rss);
 
 /* gui-utils.c
 */

commit 8876712e765a81629d8437664565fedd0945ecb8
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Add ghid_route_style_selector_empty to GHidRouteStyleSelector

diff --git a/src/hid/gtk/ghid-route-style-selector.c b/src/hid/gtk/ghid-route-style-selector.c
index e2588b2..9f8f190 100644
--- a/src/hid/gtk/ghid-route-style-selector.c
+++ b/src/hid/gtk/ghid-route-style-selector.c
@@ -334,26 +334,9 @@ ghid_route_style_selector_class_init (GHidRouteStyleSelectorClass *klass)
 static void
 ghid_route_style_selector_finalize (GObject *object)
 {
-  GtkTreeIter iter;
   GHidRouteStyleSelector *rss = (GHidRouteStyleSelector *) object;
 
-  gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rss->model), &iter);
-  do
-    {
-      struct _route_style *rsdata;
-      gtk_tree_model_get (GTK_TREE_MODEL (rss->model),
-                          &iter, DATA_COL, &rsdata, -1);
-      if (rsdata->action)
-        {
-          gtk_action_disconnect_accelerator (GTK_ACTION (rsdata->action));
-          gtk_action_group_remove_action (rss->action_group,
-                                GTK_ACTION (rsdata->action));
-          g_object_unref (G_OBJECT (rsdata->action));
-        }
-      gtk_tree_row_reference_free (rsdata->rref);
-      free (rsdata);
-    }
-  while (gtk_tree_model_iter_next (GTK_TREE_MODEL (rss->model), &iter));
+  ghid_route_style_selector_empty (rss);
 
   g_object_unref (rss->accel_group);
   g_object_unref (rss->action_group);
@@ -623,3 +606,31 @@ ghid_route_style_selector_sync (GHidRouteStyleSelector *rss,
   while (gtk_tree_model_iter_next (GTK_TREE_MODEL (rss->model), &iter));
 }
 
+/*! \brief Removes all styles from a route style selector */
+void
+ghid_route_style_selector_empty (GHidRouteStyleSelector *rss)
+{
+  GtkTreeIter iter;
+  gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rss->model), &iter);
+  do
+    {
+      struct _route_style *rsdata;
+      gtk_tree_model_get (GTK_TREE_MODEL (rss->model),
+                          &iter, DATA_COL, &rsdata, -1);
+      if (rsdata->action)
+        {
+          gtk_action_disconnect_accelerator (GTK_ACTION (rsdata->action));
+          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_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;
+}
+
diff --git a/src/hid/gtk/ghid-route-style-selector.h b/src/hid/gtk/ghid-route-style-selector.h
index 53c481f..6e934b9 100644
--- a/src/hid/gtk/ghid-route-style-selector.h
+++ b/src/hid/gtk/ghid-route-style-selector.h
@@ -36,6 +36,7 @@ GtkAccelGroup *ghid_route_style_selector_get_accel_group
 void ghid_route_style_selector_sync (GHidRouteStyleSelector *rss,
                                      Coord Thick, Coord Diameter,
                                      Coord Hole, Coord Keepaway);
+void ghid_route_style_selector_empty (GHidRouteStyleSelector *rss);
 
 G_END_DECLS  /* keep c++ happy */
 #endif

commit 499fe7a6b88a526f6b48d671107ac3d9ec725290
Author: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>
Commit: Andrew Poelstra (local) <apoelstra@xxxxxxxxxxxxxx>

    Add finalize function to GHidRouteStyleSelector

diff --git a/src/hid/gtk/ghid-route-style-selector.c b/src/hid/gtk/ghid-route-style-selector.c
index 4bc4748..e2588b2 100644
--- a/src/hid/gtk/ghid-route-style-selector.c
+++ b/src/hid/gtk/ghid-route-style-selector.c
@@ -4,8 +4,6 @@
  *  Please write description here.
  */
 
-/* TODO: write finalize function */
-
 #include <glib.h>
 #include <glib-object.h>
 #include <gdk/gdkkeysyms.h>
@@ -22,6 +20,7 @@
 struct _route_style;
 struct _route_style *ghid_route_style_selector_real_add_route_style
   (GHidRouteStyleSelector *, RouteStyleType *, gboolean temp);
+static void ghid_route_style_selector_finalize (GObject *object);
 
 /*! \brief Global action creation counter */
 static gint action_count;
@@ -40,6 +39,7 @@ enum {
   N_COLS
 };
 
+static GtkVBox *ghid_route_style_selector_parent_class;
 static guint ghid_route_style_selector_signals[LAST_SIGNAL] = { 0 };
 
 struct _GHidRouteStyleSelector
@@ -305,6 +305,10 @@ ghid_route_style_selector_init (GHidRouteStyleSelector *rss)
 static void
 ghid_route_style_selector_class_init (GHidRouteStyleSelectorClass *klass)
 {
+  GObjectClass *object_class = (GObjectClass *) klass;
+
+  ghid_route_style_selector_parent_class = g_type_class_peek_parent (klass);
+
   ghid_route_style_selector_signals[SELECT_STYLE_SIGNAL] =
     g_signal_new ("select-style",
                   G_TYPE_FROM_CLASS (klass),
@@ -321,6 +325,40 @@ ghid_route_style_selector_class_init (GHidRouteStyleSelectorClass *klass)
                   NULL, NULL,
                   g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE,
                   1, G_TYPE_BOOLEAN);
+
+  object_class->finalize = ghid_route_style_selector_finalize;
+}
+
+/*! \brief Clean up object before garbage collection
+ */
+static void
+ghid_route_style_selector_finalize (GObject *object)
+{
+  GtkTreeIter iter;
+  GHidRouteStyleSelector *rss = (GHidRouteStyleSelector *) object;
+
+  gtk_tree_model_get_iter_first (GTK_TREE_MODEL (rss->model), &iter);
+  do
+    {
+      struct _route_style *rsdata;
+      gtk_tree_model_get (GTK_TREE_MODEL (rss->model),
+                          &iter, DATA_COL, &rsdata, -1);
+      if (rsdata->action)
+        {
+          gtk_action_disconnect_accelerator (GTK_ACTION (rsdata->action));
+          gtk_action_group_remove_action (rss->action_group,
+                                GTK_ACTION (rsdata->action));
+          g_object_unref (G_OBJECT (rsdata->action));
+        }
+      gtk_tree_row_reference_free (rsdata->rref);
+      free (rsdata);
+    }
+  while (gtk_tree_model_iter_next (GTK_TREE_MODEL (rss->model), &iter));
+
+  g_object_unref (rss->accel_group);
+  g_object_unref (rss->action_group);
+
+  G_OBJECT_CLASS (ghid_route_style_selector_parent_class)->finalize (object);
 }
 
 /* PUBLIC FUNCTIONS */




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