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

gEDA-cvs: branch: master updated (1.1.2.20070818-61-gbdc4d9c)



The branch, master has been updated
       via  bdc4d9ce6522fca0bf5332cb9c5228e03861c079 (commit)
       via  8ca8f4d38990365a2455999ea7e649156d2f6f90 (commit)
       via  fcbfa052a9bafdd11092a99909dc587476ef8612 (commit)
      from  201b6aecab7f3f0f86b6d89479e7c229d4e6fb30 (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
=========

 gschem/include/prototype.h |    2 +-
 gschem/src/g_keys.c        |   27 +++++++++---------
 gschem/src/x_compselect.c  |   64 ++++++++++++++++++++++++++-----------------
 gschem/src/x_event.c       |    2 +-
 4 files changed, 54 insertions(+), 41 deletions(-)


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

commit bdc4d9ce6522fca0bf5332cb9c5228e03861c079
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Sep 9 14:14:44 2007 +0100

    Avoid un-necessary usage of global_window_current in g_keys_execute()

:100644 100644 4fe3d46... 9c6dfa2... M	gschem/include/prototype.h
:100644 100644 fcebc39... 5e06c75... M	gschem/src/g_keys.c
:100644 100644 16b99b6... 5635ba0... M	gschem/src/x_event.c

commit 8ca8f4d38990365a2455999ea7e649156d2f6f90
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Sep 9 14:14:42 2007 +0100

    Avoid use of global_window_current in gschem/src/x_compselect.c

:100644 100644 5854070... 9ed8c3d... M	gschem/src/x_compselect.c

commit fcbfa052a9bafdd11092a99909dc587476ef8612
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Sep 9 14:04:21 2007 +0100

    Use a GObject constructor, not instance_init for compselect the dialog.
    
    Using a GObject constructor allows access to the construct time properties
    of the object during initialisation, whereas at execution of the GType
    instance_init function, those properties have not been set.

:100644 100644 8c9da39... 5854070... M	gschem/src/x_compselect.c

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

commit bdc4d9ce6522fca0bf5332cb9c5228e03861c079
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Sep 9 14:14:44 2007 +0100

    Avoid un-necessary usage of global_window_current in g_keys_execute()

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 4fe3d46..9c6dfa2 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -42,7 +42,7 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
 		    SCM scm_angle, SCM scm_selectable, SCM scm_mirror);
 SCM g_get_objects_in_page(SCM page_smob);
 /* g_keys.c */
-int g_keys_execute(int state, int keyval);
+int g_keys_execute(TOPLEVEL *w_current, int state, int keyval);
 GArray *g_keys_dump_keymap (void);
 SCM g_keys_file_new(void);
 SCM g_keys_file_new_window(void);
diff --git a/gschem/src/g_keys.c b/gschem/src/g_keys.c
index fcebc39..5e06c75 100644
--- a/gschem/src/g_keys.c
+++ b/gschem/src/g_keys.c
@@ -47,9 +47,8 @@
  *
  */
 /* for now this only supports single chars, not shift/alt/ctrl etc... */
-int g_keys_execute(int state, int keyval)
+int g_keys_execute(TOPLEVEL *w_current, int state, int keyval)
 {
-  TOPLEVEL *w = global_window_current;
   char *guile_string = NULL;
   char *modifier = NULL;
   char *key_name = NULL;
@@ -81,26 +80,26 @@ int g_keys_execute(int state, int keyval)
     modifier = g_strdup("");
 
   if(strcmp(key_name, "Escape") == 0) {
-     g_free(w->keyaccel_string);
-     w->keyaccel_string = NULL;
-  } else if(w->keyaccel_string &&
-        strlen(w->keyaccel_string) + strlen(key_name) > 10) {
-     g_free(w->keyaccel_string);
-     w->keyaccel_string = g_strconcat(modifier, key_name, NULL);
+     g_free(w_current->keyaccel_string);
+     w_current->keyaccel_string = NULL;
+  } else if(w_current->keyaccel_string &&
+        strlen(w_current->keyaccel_string) + strlen(key_name) > 10) {
+     g_free(w_current->keyaccel_string);
+     w_current->keyaccel_string = g_strconcat(modifier, key_name, NULL);
   } else {
      gchar *p, *r;
 
-     p = w->keyaccel_string;
-     w->keyaccel_string = g_strconcat(modifier, key_name, NULL);
+     p = w_current->keyaccel_string;
+     w_current->keyaccel_string = g_strconcat(modifier, key_name, NULL);
      if(p) {
-        r = g_strconcat(p, w->keyaccel_string, NULL);
+        r = g_strconcat(p, w_current->keyaccel_string, NULL);
         g_free(p);
-        g_free(w->keyaccel_string);
-        w->keyaccel_string = r;
+        g_free(w_current->keyaccel_string);
+        w_current->keyaccel_string = r;
      }
   }
 
-  i_show_state(w, NULL);
+  i_show_state(w_current, NULL);
 
   guile_string = g_strdup_printf("(press-key \"%s%s\")",
                                  modifier, key_name);
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index 16b99b6..5635ba0 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -1504,7 +1504,7 @@ gboolean x_event_key_press (GtkWidget *widget, GdkEventKey *event,
 #if DEBUG
     printf("x_event_key_pressed: Pressed key %i.\n", event->keyval);
 #endif
-    retval = g_keys_execute(event->state, event->keyval) ? TRUE : FALSE;
+    retval = g_keys_execute(w_current, event->state, event->keyval) ? TRUE : FALSE;
   }
 
   return retval;

commit 8ca8f4d38990365a2455999ea7e649156d2f6f90
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Sep 9 14:14:42 2007 +0100

    Avoid use of global_window_current in gschem/src/x_compselect.c

diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
index 5854070..9ed8c3d 100644
--- a/gschem/src/x_compselect.c
+++ b/gschem/src/x_compselect.c
@@ -553,7 +553,7 @@ compselect_callback_behavior_changed (GtkOptionMenu *optionmenu,
  * use, using s_toplevel_get_symbols().
  */
 static GtkTreeModel*
-create_inuse_tree_model (void)
+create_inuse_tree_model (Compselect *compselect)
 {
   GtkListStore *store;
   GList *symhead, *symlist;
@@ -561,7 +561,7 @@ create_inuse_tree_model (void)
 
   store = (GtkListStore *) gtk_list_store_new (1, G_TYPE_POINTER);
 
-  symhead = s_toplevel_get_symbols (global_window_current);
+  symhead = s_toplevel_get_symbols (GSCHEM_DIALOG (compselect)->toplevel);
 
   for (symlist = symhead;
        symlist != NULL;
@@ -585,7 +585,7 @@ create_inuse_tree_model (void)
  * sources and the leaves are the symbols.
  */
 static GtkTreeModel*
-create_lib_tree_model (void)
+create_lib_tree_model (Compselect *compselect)
 {
   GtkTreeStore *store;
   GList *srchead, *srclist;
@@ -594,7 +594,7 @@ create_lib_tree_model (void)
   store = (GtkTreeStore*)gtk_tree_store_new (1, G_TYPE_POINTER);
   
   /* populate component store */
-  srchead = s_clib_get_sources (global_window_current->sort_component_library != 0);
+  srchead = s_clib_get_sources (GSCHEM_DIALOG (compselect)->toplevel->sort_component_library != 0);
   for (srclist = srchead; 
        srclist != NULL; 
        srclist = g_list_next (srclist)) {
@@ -641,7 +641,7 @@ compselect_callback_refresh_library (GtkButton *button, gpointer user_data)
   /* Refresh the "Library" view */
   model = (GtkTreeModel *)
     g_object_new (GTK_TYPE_TREE_MODEL_FILTER,
-                  "child-model", create_lib_tree_model (),
+                  "child-model", create_lib_tree_model (compselect),
                   "virtual-root", NULL,
                   NULL);
 
@@ -653,7 +653,7 @@ compselect_callback_refresh_library (GtkButton *button, gpointer user_data)
   gtk_tree_view_set_model (compselect->libtreeview, model);
 
   /* Refresh the "In Use" view */
-  model = create_inuse_tree_model ();
+  model = create_inuse_tree_model (compselect);
   gtk_tree_view_set_model (compselect->inusetreeview, model);
 }
 
@@ -667,7 +667,7 @@ create_inuse_treeview (Compselect *compselect)
   GtkCellRenderer *renderer;
   GtkTreeViewColumn *column;
 
-  model = create_inuse_tree_model ();
+  model = create_inuse_tree_model (compselect);
 
   /* Create a scrolled window to accomodate the treeview */
   scrolled_win = GTK_WIDGET (
@@ -743,7 +743,7 @@ create_lib_treeview (Compselect *compselect)
                                    "spacing",      5,
                                    NULL));
 
-  child_model  = create_lib_tree_model ();
+  child_model  = create_lib_tree_model (compselect);
   model = (GtkTreeModel*)g_object_new (GTK_TYPE_TREE_MODEL_FILTER,
                                        "child-model",  child_model,
                                        "virtual-root", NULL,

commit fcbfa052a9bafdd11092a99909dc587476ef8612
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sun Sep 9 14:04:21 2007 +0100

    Use a GObject constructor, not instance_init for compselect the dialog.
    
    Using a GObject constructor allows access to the construct time properties
    of the object during initialisation, whereas at execution of the GType
    instance_init function, those properties have not been set.

diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
index 8c9da39..5854070 100644
--- a/gschem/src/x_compselect.c
+++ b/gschem/src/x_compselect.c
@@ -246,17 +246,19 @@ enum {
 static GObjectClass *compselect_parent_class = NULL;
 
 
-static void compselect_class_init (CompselectClass *class);
-static void compselect_init       (Compselect *compselect);
-static void compselect_finalize     (GObject *object);
-static void compselect_set_property (GObject *object,
-                                     guint property_id,
-                                     const GValue *value,
-                                     GParamSpec *pspec);
-static void compselect_get_property (GObject *object,
-                                     guint property_id,
-                                     GValue *value,
-                                     GParamSpec *pspec);
+static void compselect_class_init      (CompselectClass *class);
+static GObject *compselect_constructor (GType type,
+                                        guint n_construct_properties,
+                                        GObjectConstructParam *construct_params);
+static void compselect_finalize        (GObject *object);
+static void compselect_set_property    (GObject *object,
+                                        guint property_id,
+                                        const GValue *value,
+                                        GParamSpec *pspec);
+static void compselect_get_property    (GObject *object,
+                                        guint property_id,
+                                        GValue *value,
+                                        GParamSpec *pspec);
 
 
 
@@ -928,7 +930,7 @@ compselect_get_type ()
       NULL, /* class_data */
       sizeof(Compselect),
       0,    /* n_preallocs */
-      (GInstanceInitFunc) compselect_init,
+      NULL  /* instance_init */
     };
                 
     compselect_type = g_type_register_static (GSCHEM_TYPE_DIALOG,
@@ -1009,6 +1011,7 @@ compselect_class_init (CompselectClass *klass)
   gschem_dialog_class->geometry_restore = compselect_geometry_restore;
 #endif
 
+  gobject_class->constructor  = compselect_constructor;
   gobject_class->finalize     = compselect_finalize;
   gobject_class->set_property = compselect_set_property;
   gobject_class->get_property = compselect_get_property;
@@ -1039,17 +1042,26 @@ compselect_class_init (CompselectClass *klass)
   
 }
 
-static void
-compselect_init (Compselect *compselect)
+static GObject*
+compselect_constructor (GType type,
+                        guint n_construct_properties,
+                        GObjectConstructParam *construct_params)
 {
+  GObject *object;
+  Compselect *compselect;
+
   GtkWidget *hpaned, *notebook;
   GtkWidget *libview, *inuseview;
   GtkWidget *preview, *combobox;
-  
   GtkWidget *alignment, *frame;
-  
+
+  /* chain up to constructor of parent class */
+  object = G_OBJECT_CLASS (compselect_parent_class)->
+    constructor (type, n_construct_properties, construct_params);
+  compselect = COMPSELECT (object);
+
   /* dialog initialization */
-  g_object_set (G_OBJECT (compselect),
+  g_object_set (object,
                 /* GtkWindow */
                 "type",            GTK_WINDOW_TOPLEVEL,
                 "title",           _("Select Component..."),
@@ -1153,6 +1165,8 @@ compselect_init (Compselect *compselect)
 
   /* Initialize the hidden property */
   compselect->hidden = FALSE;
+
+  return object;
 }
 
 static void




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