[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.6.1-20100214-115-gb5cf934)
The branch, master has been updated
via b5cf93429f13cf9e68cc9cf86a05d72eae239f6f (commit)
from 84c708ec13ab8cbd2f66eea3239ce8106232ffab (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/x_menus.c | 18 ++++++++++--------
gschem/src/x_window.c | 2 +-
3 files changed, 12 insertions(+), 10 deletions(-)
=================
Commit Messages
=================
commit b5cf93429f13cf9e68cc9cf86a05d72eae239f6f
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
gschem: Pass the current GSCHEM_TOPLEVEL to menu signal handlers.
This has the beneficial side-effect of fixing a memory leak.
:100644 100644 c6129df... 5b71022... M gschem/include/prototype.h
:100644 100644 7dc3d04... 369eb36... M gschem/src/x_menus.c
:100644 100644 0d80087... 8d2bf24... M gschem/src/x_window.c
=========
Changes
=========
commit b5cf93429f13cf9e68cc9cf86a05d72eae239f6f
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Commit: Peter TB Brett <peter@xxxxxxxxxxxxx>
gschem: Pass the current GSCHEM_TOPLEVEL to menu signal handlers.
This has the beneficial side-effect of fixing a memory leak.
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index c6129df..5b71022 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -815,7 +815,7 @@ void x_log_message (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message);
/* x_menus.c */
-void get_main_menu(GtkWidget **menubar);
+GtkWidget *get_main_menu(GSCHEM_TOPLEVEL *w_current);
GtkWidget *get_main_popup(GSCHEM_TOPLEVEL *w_current);
gint do_popup(GSCHEM_TOPLEVEL *w_current, GdkEventButton *event);
void x_menus_sensitivity(GSCHEM_TOPLEVEL *w_current, const char *buf, int flag);
diff --git a/gschem/src/x_menus.c b/gschem/src/x_menus.c
index 7dc3d04..369eb36 100644
--- a/gschem/src/x_menus.c
+++ b/gschem/src/x_menus.c
@@ -64,10 +64,12 @@ int npopup_items = sizeof(popup_items) / sizeof(popup_items[0]);
* \par Function Description
*
*/
-static void g_menu_execute(char *func)
+static void g_menu_execute(GtkAction *action, gpointer user_data)
{
gchar *guile_string;
-
+ const gchar *func = gtk_action_get_name (action);
+ GSCHEM_TOPLEVEL *w_current = (GSCHEM_TOPLEVEL *) user_data;
+
guile_string = g_strdup_printf("(%s)", func);
#if DEBUG
printf("%s\n", guile_string);
@@ -81,7 +83,8 @@ static void g_menu_execute(char *func)
* \par Function Description
*
*/
-void get_main_menu(GtkWidget ** menubar)
+GtkWidget *
+get_main_menu(GSCHEM_TOPLEVEL *w_current)
{
char *buf;
GschemAction *action;
@@ -192,10 +195,9 @@ void get_main_menu(GtkWidget ** menubar)
menu_item = gtk_action_create_menu_item (GTK_ACTION (action));
gtk_menu_append (GTK_MENU (menu), menu_item);
- gtk_signal_connect_object (GTK_OBJECT(menu_item), "activate",
- GTK_SIGNAL_FUNC(g_menu_execute),
- (gpointer) g_strdup (menu_item_func));
- /* The g_strdup is a memory leak, but this is okay. I think. */
+ g_signal_connect (GTK_OBJECT(action), "activate",
+ GTK_SIGNAL_FUNC(g_menu_execute),
+ (gpointer) w_current);
}
gtk_widget_show (menu_item);
@@ -220,7 +222,7 @@ void get_main_menu(GtkWidget ** menubar)
}
g_free(raw_menu_name);
- *menubar = menu_bar;
+ return menu_bar;
}
/*! \todo Finish function documentation!!!
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 0d80087..8d2bf24 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -284,7 +284,7 @@ void x_window_create_main(GSCHEM_TOPLEVEL *w_current)
gtk_container_border_width(GTK_CONTAINER(main_box), 0);
gtk_container_add(GTK_CONTAINER(w_current->main_window), main_box);
- get_main_menu(&menubar);
+ menubar = get_main_menu (w_current);
if (w_current->handleboxes) {
handlebox = gtk_handle_box_new ();
gtk_box_pack_start(GTK_BOX(main_box), handlebox, FALSE, FALSE, 0);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs