[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (6d19063528190b3d678470919f51e59a1cc07a4d)
The branch, master has been updated
via 6d19063528190b3d678470919f51e59a1cc07a4d (commit)
via 9813794857f2892408a11ee69735899562b3acc2 (commit)
from 6b0b7b235c7b9937cdc22126ca9ed7a1194a4d05 (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/common/hid_resource.c | 2 +-
src/hid/common/hid_resource.h | 2 +-
src/hid/gtk/gtk-pcb-layer-selector.c | 42 ++++++++++++++++++++++-----------
src/hid/gtk/gui-top-window.c | 35 +++++++++++++--------------
src/res_parse.y | 8 +++---
src/resource.h | 6 ++--
6 files changed, 54 insertions(+), 41 deletions(-)
=================
Commit Messages
=================
commit 6d19063528190b3d678470919f51e59a1cc07a4d
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
gtk: Const-correct add_resource_to_menu and related functions
Five files have had const keywords added:
../common/hid_resource.c
../common/hid_resource.h
gui-top-window.c
../../res_parse.y
../../resource.h
No casts were added. No compilation warnings were added.
:100644 100644 11f1171... 842a058... M src/hid/common/hid_resource.c
:100644 100644 d011b31... bb3ccb6... M src/hid/common/hid_resource.h
:100644 100644 d9b3f11... 26e0030... M src/hid/gtk/gui-top-window.c
:100644 100644 373785c... efc44a0... M src/res_parse.y
:100644 100644 614aace... 119d615... M src/resource.h
commit 9813794857f2892408a11ee69735899562b3acc2
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Delete GtkAction along with layer in gtk-pcb-layer-selector.c
:100644 100644 897cd2c... c8c9849... M src/hid/gtk/gtk-pcb-layer-selector.c
=========
Changes
=========
commit 6d19063528190b3d678470919f51e59a1cc07a4d
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
gtk: Const-correct add_resource_to_menu and related functions
Five files have had const keywords added:
../common/hid_resource.c
../common/hid_resource.h
gui-top-window.c
../../res_parse.y
../../resource.h
No casts were added. No compilation warnings were added.
diff --git a/src/hid/common/hid_resource.c b/src/hid/common/hid_resource.c
index 11f1171..842a058 100644
--- a/src/hid/common/hid_resource.c
+++ b/src/hid/common/hid_resource.c
@@ -76,7 +76,7 @@ button_name_to_num (const char *name)
}
void
-load_mouse_resource (Resource *res)
+load_mouse_resource (const Resource *res)
{
int bi, mi, a;
int action_count;
diff --git a/src/hid/common/hid_resource.h b/src/hid/common/hid_resource.h
index d011b31..bb3ccb6 100644
--- a/src/hid/common/hid_resource.h
+++ b/src/hid/common/hid_resource.h
@@ -11,7 +11,7 @@
#define M_Multi M_Mod(2)
#define M_Release (~((unsigned)-1>>1)) // set the top bit
-void load_mouse_resource (Resource *res);
+void load_mouse_resource (const Resource *res);
void do_mouse_action (int button, int mods);
#endif
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index d9b3f11..26e0030 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -146,7 +146,7 @@ typedef struct
const char *flagname;
MenuFlagType flagtype;
int oldval;
- char *xres;
+ const char *xres;
} ToggleFlagType;
/* Used by the route style buttons and menu */
@@ -275,7 +275,7 @@ ghid_check_unique_accel (const char *accelerator)
*/
static void
-note_toggle_flag (const char *actionname, MenuFlagType type, char *name)
+note_toggle_flag (const char *actionname, MenuFlagType type, const char *name)
{
#ifdef DEBUG_MENUS
@@ -428,7 +428,7 @@ ghid_menu_cb (GtkAction * action, gpointer data)
const gchar * name;
int id = 0;
int vi;
- Resource *node = NULL;
+ const Resource *node = NULL;
static int in_cb = 0;
gboolean old_holdoff;
@@ -454,7 +454,7 @@ ghid_menu_cb (GtkAction * action, gpointer data)
}
else
{
- name = (char *) data;
+ name = (const char *) data;
#ifdef DEBUG_MENUS
printf ("ghid_menu_cb(): name = \"%s\"\n", UNKNOWN (name));
#endif
@@ -2419,11 +2419,11 @@ static KeyTable key_table[] =
static int n_key_table = sizeof (key_table) / sizeof (key_table[0]);
static void
-add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
+add_resource_to_menu (const char * menu, const Resource * node, int indent)
{
int i, j;
- char *v;
- Resource *r;
+ const char *v;
+ const Resource *r;
char tmps[32];
char accel[64];
int accel_n;
@@ -2439,7 +2439,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
{
case 101: /* named subnode */
add_resource_to_menu (node->v[i].name, node->v[i].subres,
- callback, indent + INDENT_INC);
+ indent + INDENT_INC);
break;
case 1: /* unnamed subres */
@@ -2491,7 +2491,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
* "Enter" -> "Return"
*
*/
- char *p;
+ const char *p;
int j;
enum {KEY, MOD} state;
@@ -2636,8 +2636,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
#ifdef DEBUG_MENUS
printf ("allocate %ld bytes\n", l);
#endif
- if ( (menulabel = (char *) malloc ( l * sizeof (char)))
- == NULL)
+ if ( (menulabel = (char *) malloc (l)) == NULL)
{
fprintf (stderr, "add_resource_to_menu(): malloc failed\n");
exit (1);
@@ -2696,7 +2695,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
* menu/submenu
*/
add_resource_to_menu ("sub menu", node->v[i].subres,
- callback, indent + INDENT_INC);
+ indent + INDENT_INC);
ghid_ui_info_indent (indent);
/* and close this menu */
@@ -2824,7 +2823,7 @@ add_resource_to_menu (char * menu, Resource * node, void * callback, int indent)
{
case 110: /* named value = X resource */
{
- char *n = node->v[i].subres->v[j].name;
+ const char *n = node->v[i].subres->v[j].name;
/* allow fg and bg to be abbreviations for
* foreground and background
*/
@@ -3040,10 +3039,10 @@ ghid_ui_info_append (const gchar * newone)
static void
ghid_load_menus (void)
{
- char *filename;
- Resource *r = 0, *bir;
+ const char *filename;
+ const Resource *r = 0, *bir;
char *home_pcbmenu;
- Resource *mr;
+ const Resource *mr;
int i;
for (i = 0; i < sizeof (ghid_hotkey_actions) / sizeof (char *) ; i++)
@@ -3106,7 +3105,7 @@ ghid_load_menus (void)
ghid_ui_info_append ("<ui>\n");
ghid_ui_info_indent (INDENT_INC);
ghid_ui_info_append ("<menubar name='MenuBar'>\n");
- add_resource_to_menu ("Initial Call", mr, 0, 2*INDENT_INC);
+ add_resource_to_menu ("Initial Call", mr, 2*INDENT_INC);
ghid_ui_info_indent (INDENT_INC);
ghid_ui_info_append ("</menubar>\n");
}
@@ -3129,7 +3128,7 @@ ghid_load_menus (void)
ghid_ui_info_append (mr->v[i].name);
ghid_ui_info_append ("'>\n");
add_resource_to_menu ("Initial Call", mr->v[i].subres,
- 0, 2*INDENT_INC);
+ 2*INDENT_INC);
ghid_ui_info_indent (INDENT_INC);
ghid_ui_info_append ("</popup>\n");
}
diff --git a/src/res_parse.y b/src/res_parse.y
index 373785c..efc44a0 100644
--- a/src/res_parse.y
+++ b/src/res_parse.y
@@ -76,7 +76,7 @@ res_item
%%
-static char *res_filename = 0;
+static const char *res_filename = 0;
static FILE *res_file = 0;
static const char **res_strings = 0;
static int res_string_idx = 0;
@@ -110,7 +110,7 @@ res_parse_getchars(char *buf, int max_size)
}
Resource *
-resource_parse(char *filename, const char **strings)
+resource_parse(const char *filename, const char **strings)
{
res_lineno = 1;
if (filename)
@@ -165,7 +165,7 @@ resource_add_val(Resource *n, char *name, char *value, Resource *subres)
}
char *
-resource_value(Resource *res, char *name)
+resource_value(const Resource *res, char *name)
{
int i;
if (res == 0 || name == 0)
@@ -178,7 +178,7 @@ resource_value(Resource *res, char *name)
}
Resource *
-resource_subres(Resource *res, char *name)
+resource_subres(const Resource *res, const char *name)
{
int i;
if (res == 0 || name == 0)
diff --git a/src/resource.h b/src/resource.h
index 614aace..119d615 100644
--- a/src/resource.h
+++ b/src/resource.h
@@ -38,9 +38,9 @@ extern "C"
/* res_parse.y */
/* Pass either filename OR stringtab. */
- Resource *resource_parse (char *filename, const char **stringtab);
- char *resource_value (Resource * res, char *name);
- Resource *resource_subres (Resource * res, char *name);
+ Resource *resource_parse (const char *filename, const char **stringtab);
+ char *resource_value (const Resource * res, char *name);
+ Resource *resource_subres (const Resource * res, const char *name);
Resource *resource_create (Resource * parent);
void resource_add_val (Resource * n, char *name, char *value,
commit 9813794857f2892408a11ee69735899562b3acc2
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>
Delete GtkAction along with layer in gtk-pcb-layer-selector.c
diff --git a/src/hid/gtk/gtk-pcb-layer-selector.c b/src/hid/gtk/gtk-pcb-layer-selector.c
index 897cd2c..c8c9849 100644
--- a/src/hid/gtk/gtk-pcb-layer-selector.c
+++ b/src/hid/gtk/gtk-pcb-layer-selector.c
@@ -185,10 +185,9 @@ menu_view_cb (GtkToggleAction *action, GtkTreeRowReference *rref)
/*! \brief Callback for menu actions: sync layer selection list, emit signal */
static void
-menu_pick_cb (GtkRadioAction *action, GtkPcbLayerSelector *ls)
+menu_pick_cb (GtkRadioAction *action, GtkTreeRowReference *rref)
{
- int idx = gtk_radio_action_get_current_value (action);
- GtkTreeRowReference *rref = ls->rows[idx];
+ GtkPcbLayerSelector *ls;
GtkTreeModel *model = gtk_tree_row_reference_get_model (rref);
GtkTreePath *path = gtk_tree_row_reference_get_path (rref);
GtkTreeIter iter;
@@ -196,8 +195,9 @@ menu_pick_cb (GtkRadioAction *action, GtkPcbLayerSelector *ls)
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, USER_ID_COL, &user_id, -1);
- gtk_tree_selection_select_path (ls->selection, path);
+ ls = g_object_get_data (G_OBJECT (model), "layer-selector");
+ gtk_tree_selection_select_path (ls->selection, path);
g_signal_emit (ls, gtk_pcb_layer_selector_signals[SELECT_LAYER_SIGNAL],
0, user_id);
}
@@ -246,7 +246,8 @@ gtk_pcb_layer_selector_finalize (GObject *object)
g_free (ls->view_actions);
g_free (ls->pick_actions);
for (i = 0; i < ls->n_actions; ++i)
- gtk_tree_row_reference_free (ls->rows[i]);
+ if (ls->rows[i])
+ gtk_tree_row_reference_free (ls->rows[i]);
g_free (ls->rows);
G_OBJECT_CLASS (gtk_pcb_layer_selector_parent_class)->finalize (object);
@@ -476,6 +477,12 @@ gtk_pcb_layer_selector_add_layer (GtkPcbLayerSelector *ls,
paccel = g_strdup_printf ("<Alt>%d", i);
}
+ /* Create row reference for actions */
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls->list_store), &iter);
+ ls->rows[ls->n_actions] = gtk_tree_row_reference_new
+ (GTK_TREE_MODEL (ls->list_store), path);
+ gtk_tree_path_free (path);
+
/* Create selection action */
if (activatable)
{
@@ -490,7 +497,7 @@ gtk_pcb_layer_selector_add_layer (GtkPcbLayerSelector *ls,
GTK_ACTION (ls->pick_actions[ls->n_actions]),
paccel);
g_signal_connect (ls->pick_actions[ls->n_actions], "toggled",
- G_CALLBACK (menu_pick_cb), ls);
+ G_CALLBACK (menu_pick_cb), ls->rows[ls->n_actions]);
}
else
ls->pick_actions[ls->n_actions] = NULL;
@@ -500,11 +507,6 @@ gtk_pcb_layer_selector_add_layer (GtkPcbLayerSelector *ls,
NULL, NULL);
gtk_toggle_action_set_active (ls->view_actions[ls->n_actions], visible);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls->list_store), &iter);
- ls->rows[ls->n_actions] = gtk_tree_row_reference_new
- (GTK_TREE_MODEL (ls->list_store), path);
- gtk_tree_path_free (path);
-
gtk_action_group_add_action_with_accel
(ls->action_group,
GTK_ACTION (ls->view_actions[ls->n_actions]),
@@ -774,17 +776,29 @@ gtk_pcb_layer_selector_delete_layers (GtkPcbLayerSelector *ls,
do
{
gboolean sep;
- gint user_id;
+ gint user_id, idx;
gtk_tree_model_get (GTK_TREE_MODEL (ls->list_store),
&iter, USER_ID_COL, &user_id,
- SEPARATOR_COL, &sep, -1);
+ INDEX_COL, &idx, SEPARATOR_COL, &sep, -1);
/* gtk_list_store_remove will increment the iter for us, so we
* don't want to do it again in the loop condition */
needs_inc = TRUE;
if (!sep && callback (user_id))
{
if (gtk_list_store_remove (ls->list_store, &iter))
- needs_inc = FALSE;
+ {
+ if (ls->view_actions[idx])
+ gtk_action_group_remove_action (ls->action_group,
+ GTK_ACTION (ls->view_actions[idx]));
+ if (ls->pick_actions[idx])
+ gtk_action_group_remove_action (ls->action_group,
+ GTK_ACTION (ls->pick_actions[idx]));
+ gtk_tree_row_reference_free (ls->rows[idx]);
+ ls->view_actions[idx] = NULL;
+ ls->pick_actions[idx] = NULL;
+ ls->rows[idx] = NULL;
+ needs_inc = FALSE;
+ }
else
return;
if (was_separator)
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs