anjuta r4656 - in trunk: . plugins/debug-manager
- From: sgranjoux svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4656 - in trunk: . plugins/debug-manager
- Date: Sat, 31 Jan 2009 20:26:01 +0000 (UTC)
Author: sgranjoux
Date: Sat Jan 31 20:26:01 2009
New Revision: 4656
URL: http://svn.gnome.org/viewvc/anjuta?rev=4656&view=rev
Log:
* plugins/debug-manager/sharedlib.c,
plugins/debug-manager/sharedlib.h,
plugins/debug-manager/signals.c,
plugins/debug-manager/signals.h,
plugins/debug-manager/plugin.c:
Fix some warnings due to the previous patch
Modified:
trunk/ChangeLog
trunk/plugins/debug-manager/plugin.c
trunk/plugins/debug-manager/sharedlib.c
trunk/plugins/debug-manager/sharedlib.h
trunk/plugins/debug-manager/signals.c
trunk/plugins/debug-manager/signals.h
Modified: trunk/plugins/debug-manager/plugin.c
==============================================================================
--- trunk/plugins/debug-manager/plugin.c (original)
+++ trunk/plugins/debug-manager/plugin.c Sat Jan 31 20:26:01 2009
@@ -396,15 +396,6 @@
DEBUG_PRINT ("%s", "DMA: dma_plugin_program_loaded");
- if (this->sharedlibs == NULL)
- {
- this->sharedlibs = sharedlibs_new (this);
- }
- if (this->signals == NULL)
- {
- this->signals = signals_new (this);
- }
-
/* Update ui */
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (this)->shell, NULL);
gtk_action_group_set_sensitive (this->loaded_group, TRUE);
@@ -476,17 +467,6 @@
DEBUG_PRINT ("%s", "DMA: dma_plugin_program_unload");
- if (this->sharedlibs != NULL)
- {
- sharedlibs_free (this->sharedlibs);
- this->sharedlibs = NULL;
- }
- if (this->signals == NULL)
- {
- signals_free (this->signals);
- this->signals = NULL;
- }
-
/* Update ui */
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (this)->shell, NULL);
gtk_action_group_set_visible (this->start_group, TRUE);
@@ -1143,7 +1123,13 @@
/* Start debugger part */
this->start = dma_start_new (this);
-
+
+ /* Shared libraries part */
+ this->sharedlibs = sharedlibs_new (this);
+
+ /* Signal part */
+ this->signals = signals_new (this);
+
dma_plugin_debugger_stopped (this, 0);
/* Add watches */
@@ -1212,6 +1198,12 @@
dma_start_free (this->start);
this->start = NULL;
+ sharedlibs_free (this->sharedlibs);
+ this->sharedlibs = NULL;
+
+ signals_free (this->signals);
+ this->signals = NULL;
+
ui = anjuta_shell_get_ui (ANJUTA_PLUGIN (this)->shell, NULL);
anjuta_ui_remove_action_group (ui, this->start_group);
anjuta_ui_remove_action_group (ui, this->loaded_group);
Modified: trunk/plugins/debug-manager/sharedlib.c
==============================================================================
--- trunk/plugins/debug-manager/sharedlib.c (original)
+++ trunk/plugins/debug-manager/sharedlib.c Sat Jan 31 20:26:01 2009
@@ -108,13 +108,13 @@
}
static void
-sharedlibs_update_controls (Sharedlibs* ew)
+sharedlibs_update_controls (Sharedlibs* sl)
{
gboolean R;
- R = dma_debugger_queue_get_state (ew->debugger) == IANJUTA_DEBUGGER_PROGRAM_STOPPED;
+ R = dma_debugger_queue_get_state (sl->debugger) == IANJUTA_DEBUGGER_PROGRAM_STOPPED;
- gtk_action_group_set_sensitive (ew->widgets.action_group, R);
+ gtk_action_group_set_sensitive (sl->action_group, R);
}
static gboolean
@@ -148,23 +148,6 @@
};
static GtkWidget*
-create_sharedlibs_menu (Sharedlibs *sl, DebugManagerPlugin *plugin)
-{
- AnjutaUI *ui;
-
- ui = anjuta_shell_get_ui (ANJUTA_PLUGIN(plugin)->shell, NULL);
- sl->widgets.action_group =
- anjuta_ui_add_action_group_entries (ui,
- "ActionGroupSharedlibs",
- _("Sharedlibs operations"),
- sharedlibs_menu_actions,
- G_N_ELEMENTS(sharedlibs_menu_actions),
- GETTEXT_PACKAGE, TRUE, sl);
- return gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
- "/PopupSharedlibs");
-}
-
-static GtkWidget*
sharedlibs_ui_create_treeview_and_store (Sharedlibs *sl)
{
GtkWidget *treeview;
@@ -214,11 +197,20 @@
}
static void
-create_sharedlibs_gui (Sharedlibs *sl, DebugManagerPlugin *plugin)
+destroy_sharedlibs_gui (Sharedlibs *sl)
+{
+ gtk_widget_destroy(sl->widgets.window);
+ gtk_widget_destroy(sl->widgets.menu);
+ g_object_unref (sl->widgets.store);
+}
+
+static void
+create_sharedlibs_gui (Sharedlibs *sl)
{
GtkWidget *window3;
GtkWidget *scrolledwindow4;
GtkWidget *treeview;
+ AnjutaUI *ui;
window3 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize (window3, 170, -2);
@@ -248,86 +240,130 @@
sl->widgets.window = window3;
sl->widgets.treeview = treeview;
- sl->widgets.menu = create_sharedlibs_menu (sl, plugin);
+ ui = anjuta_shell_get_ui (sl->plugin->shell, NULL);
+ sl->widgets.menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
+ "/PopupSharedlibs");
+
+ sl->is_showing = FALSE;
+ sl->win_width = 410;
+ sl->win_height = 370;
+ sl->win_pos_x = 120;
+ sl->win_pos_y = 140;
}
-Sharedlibs*
-sharedlibs_new (DebugManagerPlugin *plugin)
+static void
+on_program_unloaded (Sharedlibs *sl)
{
- Sharedlibs* ew;
- ew = g_malloc(sizeof(Sharedlibs));
- if(ew)
- {
- ew->debugger = dma_debug_manager_get_queue (plugin);
-
- ew->is_showing = FALSE;
- ew->win_width = 410;
- ew->win_height = 370;
- ew->win_pos_x = 120;
- ew->win_pos_y = 140;
- create_sharedlibs_gui(ew, plugin);
- }
- return ew;
+ g_signal_handlers_disconnect_by_func (sl->plugin, G_CALLBACK (on_program_unloaded), sl);
+
+ destroy_sharedlibs_gui(sl);
}
+static void
+on_program_loaded (Sharedlibs *sl)
+{
+ create_sharedlibs_gui(sl);
+
+ g_signal_connect_swapped (sl->plugin, "program-unloaded", G_CALLBACK (on_program_unloaded), sl);
+}
+
+/* Public functions
+ *---------------------------------------------------------------------------*/
+
void
-sharedlibs_clear (Sharedlibs *sg)
+sharedlibs_clear (Sharedlibs *sl)
{
- g_return_if_fail (sg->widgets.store != NULL);
- g_return_if_fail (GTK_IS_LIST_STORE (sg->widgets.store));
+ g_return_if_fail (sl->widgets.store != NULL);
+ g_return_if_fail (GTK_IS_LIST_STORE (sl->widgets.store));
- gtk_list_store_clear (sg->widgets.store);
+ gtk_list_store_clear (sl->widgets.store);
}
void
-sharedlibs_show (Sharedlibs* ew)
+sharedlibs_show (Sharedlibs* sl)
{
- if(ew)
+ if(sl)
{
- if(ew->is_showing)
+ if(sl->is_showing)
{
- gdk_window_raise(ew->widgets.window->window);
+ gdk_window_raise(sl->widgets.window->window);
}
else
{
- gtk_widget_set_uposition(ew->widgets.window, ew->win_pos_x,
- ew->win_pos_y);
- gtk_window_set_default_size(GTK_WINDOW(ew->widgets.window),
- ew->win_width, ew->win_height);
- gtk_widget_show(ew->widgets.window);
- ew->is_showing = TRUE;
+ gtk_widget_set_uposition(sl->widgets.window, sl->win_pos_x,
+ sl->win_pos_y);
+ gtk_window_set_default_size(GTK_WINDOW(sl->widgets.window),
+ sl->win_width, sl->win_height);
+ gtk_widget_show(sl->widgets.window);
+ sl->is_showing = TRUE;
dma_queue_info_sharedlib (
- ew->debugger,
+ sl->debugger,
(IAnjutaDebuggerCallback)sharedlibs_update,
- ew);
+ sl);
}
}
}
void
-sharedlibs_hide (Sharedlibs* ew)
+sharedlibs_hide (Sharedlibs* sl)
{
- if(ew)
+ if(sl)
{
- if(ew->is_showing == FALSE) return;
- gdk_window_get_root_origin(ew ->widgets.window->window,
- &ew->win_pos_x, &ew->win_pos_y);
- gdk_window_get_size(ew ->widgets.window->window, &ew->win_width,
- &ew->win_height);
- gtk_widget_hide(ew->widgets.window);
- ew->is_showing = FALSE;
+ if(sl->is_showing == FALSE) return;
+ gdk_window_get_root_origin(sl->widgets.window->window,
+ &sl->win_pos_x, &sl->win_pos_y);
+ gdk_window_get_size(sl ->widgets.window->window, &sl->win_width,
+ &sl->win_height);
+ gtk_widget_hide(sl->widgets.window);
+ sl->is_showing = FALSE;
}
}
+/* Constructor & Destructor
+ *---------------------------------------------------------------------------*/
+
+Sharedlibs*
+sharedlibs_new (DebugManagerPlugin *plugin)
+{
+ Sharedlibs* sl;
+ AnjutaUI *ui;
+
+ sl = g_new0 (Sharedlibs, 1);
+ g_return_val_if_fail (sl != NULL, NULL);
+
+ sl->plugin = ANJUTA_PLUGIN (plugin);
+ sl->debugger = dma_debug_manager_get_queue (plugin);
+
+ ui = anjuta_shell_get_ui (ANJUTA_PLUGIN(plugin)->shell, NULL);
+ sl->action_group =
+ anjuta_ui_add_action_group_entries (ui,
+ "ActionGroupSharedlibs",
+ _("Sharedlibs operations"),
+ sharedlibs_menu_actions,
+ G_N_ELEMENTS(sharedlibs_menu_actions),
+ GETTEXT_PACKAGE, TRUE, sl);
+
+ g_signal_connect_swapped (plugin, "program-loaded", G_CALLBACK (on_program_loaded), sl);
+
+ return sl;
+}
+
void
-sharedlibs_free(Sharedlibs* sg)
+sharedlibs_free(Sharedlibs* sl)
{
- if(sg)
- {
- sharedlibs_clear(sg);
- gtk_widget_destroy(sg->widgets.window);
- gtk_widget_destroy(sg->widgets.menu);
- g_object_unref (sg->widgets.store);
- g_free(sg);
- }
+ AnjutaUI *ui;
+
+ g_return_if_fail (sl != NULL);
+
+ /* Disconnect from debugger */
+ g_signal_handlers_disconnect_matched (sl->plugin, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, sl);
+
+ /* Remove menu actions */
+ ui = anjuta_shell_get_ui (sl->plugin->shell, NULL);
+ anjuta_ui_remove_action_group (ui, sl->action_group);
+
+ /* Destroy GUI */
+ destroy_sharedlibs_gui (sl);
+
+ g_free (sl);
}
Modified: trunk/plugins/debug-manager/sharedlib.h
==============================================================================
--- trunk/plugins/debug-manager/sharedlib.h (original)
+++ trunk/plugins/debug-manager/sharedlib.h Sat Jan 31 20:26:01 2009
@@ -37,7 +37,6 @@
{
GtkWidget* window;
GtkWidget* menu;
- GtkActionGroup *action_group;
GtkWidget* treeview;
GtkListStore* store;
};
@@ -46,6 +45,8 @@
{
SharedlibsGui widgets;
DmaDebuggerQueue *debugger;
+ AnjutaPlugin *plugin;
+ GtkActionGroup *action_group;
gboolean is_showing;
gint win_pos_x, win_pos_y, win_width, win_height;
};
Modified: trunk/plugins/debug-manager/signals.c
==============================================================================
--- trunk/plugins/debug-manager/signals.c (original)
+++ trunk/plugins/debug-manager/signals.c Sat Jan 31 20:26:01 2009
@@ -50,8 +50,8 @@
R = dma_debugger_queue_get_state (ew->debugger) == IANJUTA_DEBUGGER_PROGRAM_STOPPED;
Pr = dma_debugger_queue_get_state (ew->debugger) == IANJUTA_DEBUGGER_PROGRAM_RUNNING;
- gtk_action_group_set_sensitive(ew->widgets.action_group_debugger_ok, R);
- gtk_action_group_set_sensitive(ew->widgets.action_group_program_running, Pr);
+ gtk_action_group_set_sensitive(ew->action_group_program_stopped, R);
+ gtk_action_group_set_sensitive(ew->action_group_program_running, Pr);
}
/*
@@ -195,6 +195,7 @@
gtk_menu_popup (GTK_MENU(ew->widgets.menu), NULL,
NULL, NULL, NULL,
bevent->button, bevent->time);
+
return TRUE;
}
@@ -212,24 +213,24 @@
* dma_queue_handler_signal().
*/
static void
-on_column_toggled(GtkCellRendererToggle *renderer, gchar *path, Signals *sig)
+on_column_toggled(GtkCellRendererToggle *renderer, gchar *path, Signals *sg)
{
GtkTreeIter iter;
gchar *signal;
gboolean data[SIGNAL_COLUMN_COUNT];
guint column;
- if (dma_debugger_queue_get_state (sig->debugger) != IANJUTA_DEBUGGER_PROGRAM_STOPPED)
+ if (dma_debugger_queue_get_state (sg->debugger) != IANJUTA_DEBUGGER_PROGRAM_STOPPED)
{
return;
}
column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (renderer), "__column_nr"));
- gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (sig->widgets.store),
+ gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (sg->widgets.store),
&iter,
path);
- gtk_tree_model_get (GTK_TREE_MODEL (sig->widgets.store),
+ gtk_tree_model_get (GTK_TREE_MODEL (sg->widgets.store),
&iter,
SIGNAL_COLUMN_NAME, &signal,
SIGNAL_COLUMN_STOP, &data[SIGNAL_COLUMN_STOP],
@@ -239,10 +240,10 @@
data[column] = !data[column];
- gtk_list_store_set (sig->widgets.store,
+ gtk_list_store_set (sg->widgets.store,
&iter,
column, data[column], -1);
- dma_queue_handle_signal (sig->debugger, signal,
+ dma_queue_handle_signal (sg->debugger, signal,
data[SIGNAL_COLUMN_STOP],
data[SIGNAL_COLUMN_PRINT],
data[SIGNAL_COLUMN_PASS]);
@@ -250,13 +251,12 @@
}
static void
-signals_add_toggle_column (GtkTreeView *tv, const gchar *title, guint column_num, Signals *sig)
+signals_add_toggle_column (GtkTreeView *tv, const gchar *title, guint column_num, Signals *sg)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
renderer = gtk_cell_renderer_toggle_new ();
- g_object_set (G_OBJECT (renderer), "editable", TRUE, NULL);
column = gtk_tree_view_column_new_with_attributes (title,
renderer,
"active", column_num,
@@ -264,11 +264,11 @@
gtk_tree_view_append_column (tv, column);
g_object_set_data (G_OBJECT (renderer), "__column_nr", GINT_TO_POINTER (column_num));
g_signal_connect (G_OBJECT (renderer),
- "toggled", G_CALLBACK (on_column_toggled), sig);
+ "toggled", G_CALLBACK (on_column_toggled), sg);
}
static GtkWidget *
-signals_create_list_store_and_treeview(Signals *sig)
+signals_create_list_store_and_treeview(Signals *sg)
{
GtkListStore *store;
GtkWidget *w;
@@ -292,9 +292,9 @@
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (w), column);
- signals_add_toggle_column (GTK_TREE_VIEW (w), _("Stop"), SIGNAL_COLUMN_STOP, sig);
- signals_add_toggle_column (GTK_TREE_VIEW (w), _("Print"), SIGNAL_COLUMN_PRINT, sig);
- signals_add_toggle_column (GTK_TREE_VIEW (w), _("Pass"), SIGNAL_COLUMN_PASS, sig);
+ signals_add_toggle_column (GTK_TREE_VIEW (w), _("Stop"), SIGNAL_COLUMN_STOP, sg);
+ signals_add_toggle_column (GTK_TREE_VIEW (w), _("Print"), SIGNAL_COLUMN_PRINT, sg);
+ signals_add_toggle_column (GTK_TREE_VIEW (w), _("Pass"), SIGNAL_COLUMN_PASS, sg);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Description"),
@@ -304,7 +304,7 @@
gtk_tree_view_append_column (GTK_TREE_VIEW (w), column);
g_signal_connect (G_OBJECT (w), "button-press-event",
- G_CALLBACK (on_signals_event), sig);
+ G_CALLBACK (on_signals_event), sg);
return w;
}
@@ -323,7 +323,7 @@
}
};
-static GtkActionEntry actions_signals_debugger_ok[] = {
+static GtkActionEntry actions_signals_program_stopped[] = {
{
"ActionDmaSignalUpdate",
GTK_STOCK_REFRESH,
@@ -334,13 +334,21 @@
}
};
+static void
+destroy_signals_gui (Signals *sg)
+{
+ gtk_widget_destroy (sg->widgets.window);
+ gtk_widget_destroy (sg->widgets.menu);
+ g_object_unref (sg->widgets.store);
+}
static void
-create_signals_gui (Signals *cr)
+create_signals_gui (Signals *sg)
{
GtkWidget *window3;
GtkWidget *scrolledwindow4;
GtkWidget *tv;
+ AnjutaUI *ui;
window3 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize (window3, 170, -2);
@@ -354,55 +362,47 @@
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- tv = signals_create_list_store_and_treeview (cr);
+ tv = signals_create_list_store_and_treeview (sg);
gtk_widget_show (tv);
gtk_container_add (GTK_CONTAINER (scrolledwindow4), tv);
gtk_signal_connect (GTK_OBJECT (window3), "delete_event",
- GTK_SIGNAL_FUNC (on_signals_delete_event), cr);
+ GTK_SIGNAL_FUNC (on_signals_delete_event),sg);
gtk_signal_connect (GTK_OBJECT (window3), "key-press-event",
- GTK_SIGNAL_FUNC (on_signals_key_press_event), cr);
+ GTK_SIGNAL_FUNC (on_signals_key_press_event), sg);
+
+ sg->widgets.window = window3;
+ sg->widgets.treeview = tv;
+ sg->widgets.store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (tv)));
+ ui = anjuta_shell_get_ui (sg->plugin->shell, NULL);
+ sg->widgets.menu = gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
+ "/PopupSignals");
- cr->widgets.window = window3;
- cr->widgets.treeview = tv;
- cr->widgets.store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (tv)));
+ sg->is_showing = FALSE;
+ sg->win_width = 460;
+ sg->win_height = 320;
+ sg->win_pos_x = 150;
+ sg->win_pos_y = 130;
}
-Signals *
-signals_new (DebugManagerPlugin *plugin)
+static void
+on_program_exited (Signals * sg)
{
- Signals *ew;
- AnjutaUI *ui;
- ew = g_malloc (sizeof (Signals));
- if (ew)
- {
- ew->plugin = plugin;
- ew->debugger = dma_debug_manager_get_queue (plugin);
- ew->is_showing = FALSE;
- ew->win_width = 460;
- ew->win_height = 320;
- ew->win_pos_x = 150;
- ew->win_pos_y = 130;
- create_signals_gui (ew);
- ui = anjuta_shell_get_ui (ANJUTA_PLUGIN(plugin)->shell, NULL);
- ew->widgets.action_group_debugger_ok =
- anjuta_ui_add_action_group_entries (ui, "ActionGroupSignalsDebuggerOk",
- _("Signal operations"),
- actions_signals_debugger_ok,
- G_N_ELEMENTS (actions_signals_debugger_ok),
- GETTEXT_PACKAGE, TRUE, ew);
- ew->widgets.action_group_program_running =
- anjuta_ui_add_action_group_entries (ui, "ActionGroupSignalsProgramRunning",
- _("Signal operations"),
- actions_signals_program_running,
- G_N_ELEMENTS (actions_signals_program_running),
- GETTEXT_PACKAGE, TRUE, ew);
- ew->widgets.menu = GTK_MENU (gtk_ui_manager_get_widget (GTK_UI_MANAGER (ui),
- "/PopupSignals"));
+ g_signal_handlers_disconnect_by_func (sg->plugin, G_CALLBACK (on_program_exited), sg);
- }
- return ew;
+ destroy_signals_gui(sg);
}
+static void
+on_program_started (Signals * sg)
+{
+ create_signals_gui(sg);
+
+ g_signal_connect_swapped (sg->plugin, "program-exited", G_CALLBACK (on_program_exited), sg);
+}
+
+/* Public functions
+ *---------------------------------------------------------------------------*/
+
void
signals_clear (Signals * sg)
{
@@ -413,57 +413,97 @@
}
void
-signals_show (Signals * ew)
+signals_show (Signals * sg)
{
- if (ew)
+ if (sg)
{
- if (ew->is_showing)
+ if (sg->is_showing)
{
- gdk_window_raise (ew->widgets.window->window);
+ gdk_window_raise (sg->widgets.window->window);
}
else
{
- gtk_widget_set_uposition (ew->widgets.window, ew->win_pos_x,
- ew->win_pos_y);
- gtk_window_set_default_size (GTK_WINDOW (ew->widgets.window),
- ew->win_width, ew->win_height);
- gtk_widget_show (ew->widgets.window);
- ew->is_showing = TRUE;
+ gtk_widget_set_uposition (sg->widgets.window, sg->win_pos_x,
+ sg->win_pos_y);
+ gtk_window_set_default_size (GTK_WINDOW (sg->widgets.window),
+ sg->win_width, sg->win_height);
+ gtk_widget_show (sg->widgets.window);
+ sg->is_showing = TRUE;
dma_queue_info_signal (
- ew->debugger,
+ sg->debugger,
(IAnjutaDebuggerCallback)signals_update,
- ew);
+ sg);
}
}
}
void
-signals_hide (Signals * ew)
+signals_hide (Signals * sg)
{
- if (ew)
+ if (sg)
{
- if (ew->is_showing == FALSE)
+ if (sg->is_showing == FALSE)
return;
- gdk_window_get_root_origin (ew->widgets.window->window, &ew->win_pos_x,
- &ew->win_pos_y);
- gdk_window_get_size (ew->widgets.window->window, &ew->win_width,
- &ew->win_height);
- gtk_widget_hide (ew->widgets.window);
- ew->is_showing = FALSE;
+ gdk_window_get_root_origin (sg->widgets.window->window, &sg->win_pos_x,
+ &sg->win_pos_y);
+ gdk_window_get_size (sg->widgets.window->window, &sg->win_width,
+ &sg->win_height);
+ gtk_widget_hide (sg->widgets.window);
+ sg->is_showing = FALSE;
}
}
+/* Constructor & Destructor
+ *---------------------------------------------------------------------------*/
+
+Signals *
+signals_new (DebugManagerPlugin *plugin)
+{
+ Signals *sg;
+ AnjutaUI *ui;
+
+ sg = g_new0 (Signals, 1);
+ g_return_val_if_fail (sg != NULL, NULL);
+
+ sg->plugin = ANJUTA_PLUGIN (plugin);
+ sg->debugger = dma_debug_manager_get_queue (plugin);
+
+ ui = anjuta_shell_get_ui (ANJUTA_PLUGIN(plugin)->shell, NULL);
+ sg->action_group_program_stopped =
+ anjuta_ui_add_action_group_entries (ui, "ActionGroupSignalsProgramStopped",
+ _("Signal operations"),
+ actions_signals_program_stopped,
+ G_N_ELEMENTS (actions_signals_program_stopped),
+ GETTEXT_PACKAGE, TRUE, sg);
+ sg->action_group_program_running =
+ anjuta_ui_add_action_group_entries (ui, "ActionGroupSignalsProgramRunning",
+ _("Signal operations"),
+ actions_signals_program_running,
+ G_N_ELEMENTS (actions_signals_program_running),
+ GETTEXT_PACKAGE, TRUE, sg);
+
+ g_signal_connect_swapped (plugin, "program-started", G_CALLBACK (on_program_started), sg);
+
+ return sg;
+}
+
void
signals_free (Signals * sg)
{
- if (sg)
- {
- signals_clear (sg);
- gtk_widget_destroy (sg->widgets.window);
- g_object_unref (sg->widgets.store);
- g_object_unref (sg->widgets.menu);
- g_object_unref (sg->widgets.action_group_debugger_ok);
- g_object_unref (sg->widgets.action_group_program_running);
- g_free (sg);
- }
+ AnjutaUI *ui;
+
+ g_return_if_fail (sg != NULL);
+
+ /* Disconnect from debugger */
+ g_signal_handlers_disconnect_matched (sg->plugin, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, sg);
+
+ /* Remove menu actions */
+ ui = anjuta_shell_get_ui (sg->plugin->shell, NULL);
+ anjuta_ui_remove_action_group (ui, sg->action_group_program_stopped);
+ anjuta_ui_remove_action_group (ui, sg->action_group_program_running);
+
+ /* Destroy GUI */
+ destroy_signals_gui (sg);
+
+ g_free (sg);
}
Modified: trunk/plugins/debug-manager/signals.h
==============================================================================
--- trunk/plugins/debug-manager/signals.h (original)
+++ trunk/plugins/debug-manager/signals.h Sat Jan 31 20:26:01 2009
@@ -38,18 +38,17 @@
{
GtkWidget* window;
GtkWidget* treeview;
+ GtkWidget* menu;
GtkListStore* store;
- GtkActionGroup *action_group_debugger_ok;
- GtkActionGroup *action_group_program_running;
-
- GtkMenu* menu;
};
struct _Signals
{
SignalsGui widgets;
- DebugManagerPlugin *plugin;
+ AnjutaPlugin *plugin;
DmaDebuggerQueue *debugger;
+ GtkActionGroup *action_group_program_stopped;
+ GtkActionGroup *action_group_program_running;
gboolean is_showing;
gint win_pos_x, win_pos_y, win_width, win_height;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]