[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (dd80b3287ec84e4884e6bcf29f168f5fcef1aa73)
The branch, master has been updated
via dd80b3287ec84e4884e6bcf29f168f5fcef1aa73 (commit)
via e66a637ce9aaab6946ba9c36b9bcb839d107a821 (commit)
via 155a29d26c462a51473cc5b24215560020cfa69d (commit)
via 9345c9015e4a3fb23914d4eea65b39dde7d4f6ac (commit)
via 1b98f800696dfcf9f7d6d722612fdd47ea252820 (commit)
via d602d724421312816465777e15cdffc55d394066 (commit)
from 4082cf886a5d65464b8e3e36a3724c5142adb92e (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-layer-selector.c | 76 ++++++++++++++++++++-----------------
src/hid/gtk/ghid-layer-selector.h | 1 -
src/hid/gtk/gui-command-window.c | 6 +++
src/hid/gtk/gui-top-window.c | 12 +++---
4 files changed, 53 insertions(+), 42 deletions(-)
=================
Commit Messages
=================
commit dd80b3287ec84e4884e6bcf29f168f5fcef1aa73
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Fix invalid free of ~/.pcb/filename path in gui-top-window.c
:100644 100644 c292660... e0e5eec... M src/hid/gtk/gui-top-window.c
commit e66a637ce9aaab6946ba9c36b9bcb839d107a821
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
minor: fix comment and forward declaration in ghid-layer-selector
:100644 100644 b51a0ec... 2c5d0e5... M src/hid/gtk/ghid-layer-selector.c
:100644 100644 10355a7... 887d6de... M src/hid/gtk/ghid-layer-selector.h
commit 155a29d26c462a51473cc5b24215560020cfa69d
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Remove default layer selection from ghid-layer-selector.c
Having the layer selector select its own first layer is not
needed - pcb does this for us, after making the widget. It's
not the sort of decision a widget should be making on its own,
anyway.
:100644 100644 d0a3cbf... b51a0ec... M src/hid/gtk/ghid-layer-selector.c
commit 9345c9015e4a3fb23914d4eea65b39dde7d4f6ac
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Use g_signal_handler_block instead of flags in ghid-layer-selector.c
Thanks to Peter C. for this code-cleanliness tip. Now the two
layer-selection interfaces (menu button and selector widget)
set each other's GUI state but do not raise any signals past
the original.
:100644 100644 f9d1505... d0a3cbf... M src/hid/gtk/ghid-layer-selector.c
commit 1b98f800696dfcf9f7d6d722612fdd47ea252820
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Add missing free_ldata() in ghid-layer-selector.c
:100644 100644 582fe67... f9d1505... M src/hid/gtk/ghid-layer-selector.c
commit d602d724421312816465777e15cdffc55d394066
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Disable layer selector's GtkAccelGroup while in command mode
:100644 100644 1728bd3... 3701853... M src/hid/gtk/gui-command-window.c
=========
Changes
=========
commit dd80b3287ec84e4884e6bcf29f168f5fcef1aa73
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Fix invalid free of ~/.pcb/filename path in gui-top-window.c
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index c292660..e0e5eec 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -2068,10 +2068,10 @@ ghid_check_special_key (const char *accel, GtkAction *action,
}
/*! \brief Finds the gpcb-menu.res file */
-const char *
+char *
get_menu_filename (void)
{
- const char *rv = NULL;
+ char *rv = NULL;
char *home_pcbmenu = NULL;
/* homedir is set by the core */
@@ -2085,20 +2085,19 @@ get_menu_filename (void)
Message (_("Warning: could not determine home directory\n"));
if (access ("gpcb-menu.res", R_OK) == 0)
- rv = "gpcb-menu.res";
+ rv = strdup ("gpcb-menu.res");
else if (home_pcbmenu != NULL && (access (home_pcbmenu, R_OK) == 0) )
rv = home_pcbmenu;
else if (access (pcbmenu_path, R_OK) == 0)
- rv = pcbmenu_path;
+ rv = strdup (pcbmenu_path);
- free (home_pcbmenu);
return rv;
}
static GtkWidget *
ghid_load_menus (void)
{
- const char *filename;
+ char *filename;
const Resource *r = 0, *bir;
const Resource *mr;
GtkWidget *menu_bar = NULL;
@@ -2129,6 +2128,7 @@ ghid_load_menus (void)
Message ("Using default menus\n");
r = bir;
}
+ free (filename);
mr = resource_subres (r, "MainMenu");
if (!mr)
commit e66a637ce9aaab6946ba9c36b9bcb839d107a821
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
minor: fix comment and forward declaration in ghid-layer-selector
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index b51a0ec..2c5d0e5 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -2,9 +2,8 @@
* \brief Implementation of GHidLayerSelector widget
* \par Description
* This widget is the layer selector on the left side of the Gtk
- * GUI. It also describes (in XML) the relevant sections of the
- * menu for layer selection and visibility toggling, and makes
- * sure these stay in sync.
+ * GUI. It also builds the relevant sections of the menu for layer
+ * selection and visibility toggling, and keeps these in sync.
*/
#include <glib.h>
diff --git a/src/hid/gtk/ghid-layer-selector.h b/src/hid/gtk/ghid-layer-selector.h
index 10355a7..887d6de 100644
--- a/src/hid/gtk/ghid-layer-selector.h
+++ b/src/hid/gtk/ghid-layer-selector.h
@@ -25,7 +25,6 @@ void ghid_layer_selector_add_layer (GHidLayerSelector *ls,
const gchar *color_string,
gboolean visible,
gboolean activatable);
-GtkAccelGroup *ghid_layer_selector_get_accel_group (GHidLayerSelector *ls);
gint ghid_layer_selector_install_pick_items (GHidLayerSelector *ls,
GtkMenuShell *shell, gint pos);
commit 155a29d26c462a51473cc5b24215560020cfa69d
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Remove default layer selection from ghid-layer-selector.c
Having the layer selector select its own first layer is not
needed - pcb does this for us, after making the widget. It's
not the sort of decision a widget should be making on its own,
anyway.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index d0a3cbf..b51a0ec 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -531,11 +531,6 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
new_layer->view_action = gtk_toggle_action_new (vname, name, NULL, NULL);
gtk_toggle_action_set_active (new_layer->view_action, visible);
- /* Select new layer, if we need */
- if (activatable
- && !gtk_tree_selection_get_selected (ls->selection, NULL, NULL))
- gtk_tree_selection_select_iter (ls->selection, &iter);
-
/* Determine keyboard accelerators */
for (i = 0; i < 20; ++i)
if (ls->accel_available[i])
commit 9345c9015e4a3fb23914d4eea65b39dde7d4f6ac
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Use g_signal_handler_block instead of flags in ghid-layer-selector.c
Thanks to Peter C. for this code-cleanliness tip. Now the two
layer-selection interfaces (menu button and selector widget)
set each other's GUI state but do not raise any signals past
the original.
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index f9d1505..d0a3cbf 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -22,7 +22,9 @@
#define INITIAL_ACTION_MAX 40
/* Forward dec'ls */
+struct _layer;
static void ghid_layer_selector_finalize (GObject *object);
+static void menu_pick_cb (GtkRadioAction *action, struct _layer *ldata);
/*! \brief Signals exposed by the widget */
enum {
@@ -64,7 +66,8 @@ struct _GHidLayerSelector
gboolean accel_available[20];
gboolean last_activatable;
- gboolean prevent_recursion;
+
+ gulong selection_changed_sig_id;
};
struct _GHidLayerSelectorClass
@@ -78,6 +81,7 @@ struct _GHidLayerSelectorClass
struct _layer
{
gint accel_index; /* Index into ls->accel_available */
+ gulong pick_sig_id;
GtkWidget *pick_item;
GtkWidget *view_item;
GtkToggleAction *view_action;
@@ -188,22 +192,27 @@ button_press_cb (GHidLayerSelector *ls, GdkEventButton *event)
return FALSE;
}
-/*! \brief Callback for layer selection change: sync menu */
+/*! \brief Callback for layer selection change: sync menu, emit signal */
static void
selection_changed_cb (GtkTreeSelection *selection, GHidLayerSelector *ls)
{
GtkTreeIter iter;
- ls->prevent_recursion = TRUE;
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
{
gint user_id;
struct _layer *ldata;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store), &iter,
STRUCT_COL, &ldata, USER_ID_COL, &user_id, -1);
+
if (ldata && ldata->pick_action)
- gtk_radio_action_set_current_value (ldata->pick_action, user_id);
+ {
+ g_signal_handler_block (ldata->pick_action, ldata->pick_sig_id);
+ gtk_radio_action_set_current_value (ldata->pick_action, user_id);
+ g_signal_handler_unblock (ldata->pick_action, ldata->pick_sig_id);
+ }
+ g_signal_emit (ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL],
+ 0, user_id);
}
- ls->prevent_recursion = FALSE;
}
/*! \brief Callback for menu actions: sync layer selection list, emit signal */
@@ -230,20 +239,26 @@ menu_view_cb (GtkToggleAction *action, struct _layer *ldata)
static void
menu_pick_cb (GtkRadioAction *action, struct _layer *ldata)
{
- GHidLayerSelector *ls;
- GtkTreeModel *model = gtk_tree_row_reference_get_model (ldata->rref);
- GtkTreePath *path = gtk_tree_row_reference_get_path (ldata->rref);
- GtkTreeIter iter;
- gint user_id;
+ /* We only care about the activation signal (as opposed to deactivation).
+ * A row we are /deactivating/ might not even exist anymore! */
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ {
+ GHidLayerSelector *ls;
+ GtkTreeModel *model = gtk_tree_row_reference_get_model (ldata->rref);
+ GtkTreePath *path = gtk_tree_row_reference_get_path (ldata->rref);
+ GtkTreeIter iter;
+ gint user_id;
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_model_get (model, &iter, USER_ID_COL, &user_id, -1);
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, USER_ID_COL, &user_id, -1);
- ls = g_object_get_data (G_OBJECT (model), "layer-selector");
- if (!ls->prevent_recursion)
- gtk_tree_selection_select_path (ls->selection, path);
- g_signal_emit (ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL],
- 0, user_id);
+ ls = g_object_get_data (G_OBJECT (model), "layer-selector");
+ g_signal_handler_block (ls->selection, ls->selection_changed_sig_id);
+ gtk_tree_selection_select_path (ls->selection, path);
+ g_signal_handler_unblock (ls->selection, ls->selection_changed_sig_id);
+ g_signal_emit (ls, ghid_layer_selector_signals[SELECT_LAYER_SIGNAL],
+ 0, user_id);
+ }
}
/* CONSTRUCTOR */
@@ -369,7 +384,6 @@ ghid_layer_selector_new (void)
ls->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (ls));
ls->accel_group = gtk_accel_group_new ();
ls->action_group = gtk_action_group_new ("LayerSelector");
- ls->prevent_recursion = FALSE;
ls->n_actions = 0;
for (i = 0; i < 20; ++i)
ls->accel_available[i] = TRUE;
@@ -384,8 +398,9 @@ ghid_layer_selector_new (void)
g_object_set_data (G_OBJECT (ls->list_store), "layer-selector", ls);
g_signal_connect (ls, "button_press_event",
G_CALLBACK (button_press_cb), NULL);
- g_signal_connect (ls->selection, "changed",
- G_CALLBACK (selection_changed_cb), ls);
+ ls->selection_changed_sig_id =
+ g_signal_connect (ls->selection, "changed",
+ G_CALLBACK (selection_changed_cb), ls);
g_object_ref (ls->accel_group);
@@ -543,8 +558,9 @@ ghid_layer_selector_add_layer (GHidLayerSelector *ls,
action,
accel1);
gtk_action_connect_accelerator (action);
- g_signal_connect (G_OBJECT (action), "activate",
- G_CALLBACK (menu_pick_cb), new_layer);
+ new_layer->pick_sig_id =
+ g_signal_connect (G_OBJECT (action), "activate",
+ G_CALLBACK (menu_pick_cb), new_layer);
}
gtk_action_set_accel_group (GTK_ACTION (new_layer->view_action),
ls->accel_group);
commit 1b98f800696dfcf9f7d6d722612fdd47ea252820
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Add missing free_ldata() in ghid-layer-selector.c
diff --git a/src/hid/gtk/ghid-layer-selector.c b/src/hid/gtk/ghid-layer-selector.c
index 582fe67..f9d1505 100644
--- a/src/hid/gtk/ghid-layer-selector.c
+++ b/src/hid/gtk/ghid-layer-selector.c
@@ -295,11 +295,7 @@ ghid_layer_selector_finalize (GObject *object)
struct _layer *ldata;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
&iter, STRUCT_COL, &ldata, -1);
-
- g_object_unref (G_OBJECT (ldata->pick_action));
- g_object_unref (G_OBJECT (ldata->view_action));
- gtk_tree_row_reference_free (ldata->rref);
- g_free (ldata);
+ free_ldata (ls, ldata);
}
while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ls->list_store), &iter));
commit d602d724421312816465777e15cdffc55d394066
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Disable layer selector's GtkAccelGroup while in command mode
diff --git a/src/hid/gtk/gui-command-window.c b/src/hid/gtk/gui-command-window.c
index 1728bd3..3701853 100644
--- a/src/hid/gtk/gui-command-window.c
+++ b/src/hid/gtk/gui-command-window.c
@@ -417,6 +417,9 @@ ghid_command_entry_get (gchar * prompt, gchar * command)
gtk_window_remove_accel_group (GTK_WINDOW (out->top_window),
ghid_main_menu_get_accel_group
(GHID_MAIN_MENU (ghidgui->menu_bar)));
+ gtk_window_remove_accel_group (GTK_WINDOW (out->top_window),
+ ghid_layer_selector_get_accel_group
+ (GHID_LAYER_SELECTOR (ghidgui->layer_selector)));
ghid_interface_input_signals_disconnect ();
ghid_interface_set_sensitive (FALSE);
gtk_widget_grab_focus (GTK_WIDGET (ghidgui->command_entry));
@@ -440,6 +443,9 @@ ghid_command_entry_get (gchar * prompt, gchar * command)
gtk_window_add_accel_group (GTK_WINDOW (out->top_window),
ghid_main_menu_get_accel_group
(GHID_MAIN_MENU (ghidgui->menu_bar)));
+ gtk_window_add_accel_group (GTK_WINDOW (out->top_window),
+ ghid_layer_selector_get_accel_group
+ (GHID_LAYER_SELECTOR (ghidgui->layer_selector)));
/* Restore the status line label and give focus back to the drawing area
*/
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs