Revision: 2196 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=2196&view=re... Author: cesspit Date: 2011-09-13 21:28:14 +0000 (Tue, 13 Sep 2011) Log Message: ----------- debugger: gdb error proper handling, removed char wrapped mode in messagex textview (to prevent lags when resizing), target page layout changed
Modified Paths: -------------- trunk/geany-plugins/debugger/src/Makefile.am trunk/geany-plugins/debugger/src/dbm_gdb.c trunk/geany-plugins/debugger/src/debug.c trunk/geany-plugins/debugger/src/plugin.c trunk/geany-plugins/debugger/src/tabs.c trunk/geany-plugins/debugger/src/tpage.c trunk/geany-plugins/debugger/src/tpage.h
Added Paths: ----------- trunk/geany-plugins/debugger/src/envtree.c trunk/geany-plugins/debugger/src/envtree.h
Modified: trunk/geany-plugins/debugger/src/Makefile.am =================================================================== --- trunk/geany-plugins/debugger/src/Makefile.am 2011-09-12 13:04:22 UTC (rev 2195) +++ trunk/geany-plugins/debugger/src/Makefile.am 2011-09-13 21:28:14 UTC (rev 2196) @@ -31,6 +31,8 @@ debug_module.h \ dpaned.c \ dpaned.h \ + envtree.c \ + envtree.h \ gui.h \ gui.c \ keys.c \
Modified: trunk/geany-plugins/debugger/src/dbm_gdb.c =================================================================== --- trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-09-12 13:04:22 UTC (rev 2195) +++ trunk/geany-plugins/debugger/src/dbm_gdb.c 2011-09-13 21:28:14 UTC (rev 2196) @@ -344,6 +344,8 @@ } else if (g_str_has_prefix (line, "^error")) { + dbg_cbs->set_stopped(); + /* removing read callback (will pulling all output left manually) */ g_source_remove(gdb_id_out);
Modified: trunk/geany-plugins/debugger/src/debug.c =================================================================== --- trunk/geany-plugins/debugger/src/debug.c 2011-09-12 13:04:22 UTC (rev 2195) +++ trunk/geany-plugins/debugger/src/debug.c 2011-09-13 21:28:14 UTC (rev 2196) @@ -846,6 +846,7 @@ static void on_debugger_error (const gchar* message) { dialogs_show_msgbox(GTK_MESSAGE_ERROR, "%s", message); + debug_stop(); }
/* callbacks structure to pass to debugger module */ @@ -945,7 +946,6 @@ vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(tab_messages)); debugger_messages_textview = gtk_text_view_new(); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(debugger_messages_textview), GTK_WRAP_CHAR); gtk_text_view_set_editable (GTK_TEXT_VIEW (debugger_messages_textview), FALSE); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(tab_messages), debugger_messages_textview);
Added: trunk/geany-plugins/debugger/src/envtree.c =================================================================== --- trunk/geany-plugins/debugger/src/envtree.c (rev 0) +++ trunk/geany-plugins/debugger/src/envtree.c 2011-09-13 21:28:14 UTC (rev 2196) @@ -0,0 +1,485 @@ +/* + * envtree.c + * + * Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +/* + * Working with the evironment variables tree view. + */ + +#include <string.h> + +#include "geanyplugin.h" +extern GeanyFunctions *geany_functions; +extern GeanyPlugin *geany_plugin; + +#include <gdk/gdkkeysyms.h> + +#include "dconfig.h" + +/* environment variables tree view columns */ +enum +{ + NAME, + VALUE, + LAST_VISIBLE, + N_COLUMNS +}; + +static GtkListStore *store; +static GtkTreeModel *model; +static GtkWidget *tree; + +/* flag shows that the page is readonly (debug is running) */ +static gboolean page_read_only = FALSE; + +/* flag shows we entered new env variable name and now entering its value */ +static gboolean entering_new_var = FALSE; + +/* reference to the env tree view empty row */ +static GtkTreeRowReference *empty_row = NULL; + +static GtkTreePath *being_edited_value = NULL; + +/* env variable name cloumn */ +static GtkTreeViewColumn *column_name = NULL; +static GtkCellRenderer *renderer_name = NULL; + +/* env variable value cloumn */ +static GtkTreeViewColumn *column_value = NULL; +static GtkCellRenderer *renderer_value = NULL; + +/* + * adds empty row to env tree view + */ +static void add_empty_row() +{ + if (empty_row) + gtk_tree_row_reference_free(empty_row); + + GtkTreeIter empty; + gtk_list_store_append (store, &empty); + gtk_list_store_set (store, &empty, + NAME, "", + VALUE, "", + -1); + + /* remeber reference */ + GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &empty); + empty_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path); + gtk_tree_path_free(path); +} + +/* + * delete selected rows from env variables page + */ +static void delete_selected_rows() +{ + /* path to select after deleting finishes */ + GtkTreeRowReference *reference_to_select = NULL; + + /* empty row path */ + GtkTreePath *empty_path = gtk_tree_row_reference_get_path(empty_row); + + /* get selected rows */ + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); + GList *rows = gtk_tree_selection_get_selected_rows(selection, &model); + + /* check whether only empty row was selected */ + if (1 != gtk_tree_selection_count_selected_rows(selection) || + gtk_tree_path_compare((GtkTreePath*)rows->data, empty_path)) + { + /* get references to the selected rows and find out what to + select after deletion */ + GList *references = NULL; + GList *iter = rows; + while (iter) + { + GtkTreePath *path = (GtkTreePath*)iter->data; + if (!reference_to_select) + { + /* select upper sibling of the upper + selected row that has unselected upper sibling */ + GtkTreePath *sibling = gtk_tree_path_copy(path); + if(gtk_tree_path_prev(sibling)) + { + if (!gtk_tree_selection_path_is_selected(selection, sibling)) + reference_to_select = gtk_tree_row_reference_new(gtk_tree_view_get_model(GTK_TREE_VIEW(tree)), sibling); + } + else if (gtk_tree_path_next(sibling), gtk_tree_path_compare(path, sibling)) + reference_to_select = gtk_tree_row_reference_new(gtk_tree_view_get_model(GTK_TREE_VIEW(tree)), sibling); + } + + if (gtk_tree_path_compare(path, empty_path)) + references = g_list_append(references, gtk_tree_row_reference_new(model, path)); + + iter = iter->next; + } + + /* if all (with or without empty row) was selected - set empty row + as a path to be selected after deleting */ + if (!reference_to_select) + reference_to_select = gtk_tree_row_reference_copy (empty_row); + + iter = references; + while (iter) + { + GtkTreeRowReference *reference = (GtkTreeRowReference*)iter->data; + GtkTreePath *path = gtk_tree_row_reference_get_path(reference); + + GtkTreeIter titer; + gtk_tree_model_get_iter(model, &titer, path); + gtk_list_store_remove(store, &titer); + + iter = iter->next; + } + + /* set selection */ + gtk_tree_selection_unselect_all(selection); + GtkTreePath *path = gtk_tree_row_reference_get_path(reference_to_select); + gtk_tree_selection_select_path(selection, path); + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(tree), path, NULL, TRUE, 0.5, 0.5); + + /* free references list */ + g_list_foreach (references, (GFunc)gtk_tree_row_reference_free, NULL); + g_list_free (references); + } + + /* free selection reference */ + gtk_tree_row_reference_free(reference_to_select); + + /* free rows list */ + g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); + g_list_free (rows); +} + +/* + * env tree key pressed handler + */ +static gboolean on_envtree_keypressed(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + /* do not allow deleting while debugging */ + if(page_read_only) + return FALSE; + + /* handling only Delete button pressing + that means "delete selected rows" */ + guint keyval = ((GdkEventKey*)event)->keyval; + + if (GDK_Delete == keyval) + { + delete_selected_rows(); + dconfig_set_changed(); + } + + return GDK_Tab == keyval; +} + +/* + * env tree view value column render function + */ +static void on_render_value(GtkTreeViewColumn *tree_column, + GtkCellRenderer *cell, + GtkTreeModel *tree_model, + GtkTreeIter *iter, + gpointer data) +{ + /* do not allow to edit value in read only mode */ + if (page_read_only) + { + g_object_set (cell, "editable", FALSE, NULL); + } + else + { + /* do not allow to edit value for empty row */ + GtkTreePath *path = gtk_tree_model_get_path(tree_model, iter); + gboolean empty = !gtk_tree_path_compare(path, gtk_tree_row_reference_get_path(empty_row)); + g_object_set (cell, "editable", entering_new_var || !empty, NULL); + gtk_tree_path_free(path); + } +} + +/* + * env tree view value changed handler + */ +static void on_value_changed(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer user_data) +{ + GtkTreeIter iter; + GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); + + gboolean empty = !gtk_tree_path_compare(tree_path, gtk_tree_row_reference_get_path(empty_row)); + + gtk_tree_model_get_iter ( + model, + &iter, + tree_path); + + gchar *striped = g_strstrip(g_strdup(new_text)); + + if (!strlen(striped)) + { + /* if new value is empty string, if it's a new row - do nothig + otheerwise - offer to delete a variable */ + if (empty) + gtk_list_store_set(store, &iter, NAME, "", -1); + else + { + if (dialogs_show_question(_("Delete variable?"))) + { + delete_selected_rows(); + dconfig_set_changed(); + + gtk_widget_grab_focus(tree); + } + } + } + else + { + /* if old variable - change value, otherwise - add another empty row below */ + gchar* oldvalue; + gtk_tree_model_get ( + model, + &iter, + VALUE, &oldvalue, + -1); + + if (strcmp(oldvalue, striped)) + { + gtk_list_store_set(store, &iter, VALUE, striped, -1); + if (empty) + add_empty_row(); + + g_object_set (renderer_value, "editable", FALSE, NULL); + dconfig_set_changed(); + } + + g_free(oldvalue); + } + + if (empty) + entering_new_var = FALSE; + + gtk_tree_path_free(tree_path); + g_free(striped); + + gtk_tree_path_free(being_edited_value); +} + +/* + * env tree view value editing started + */ +static void on_value_editing_started(GtkCellRenderer *renderer, GtkCellEditable *editable, gchar *path, gpointer user_data) +{ + being_edited_value = gtk_tree_path_new_from_string(path); +} + +/* + * env tree view value editing cancelled (Escape pressed) + */ +static void on_value_editing_cancelled(GtkCellRenderer *renderer, gpointer user_data) +{ + /* check whether escape was pressed when editing + new variable value cell */ + if(!gtk_tree_path_compare(being_edited_value, gtk_tree_row_reference_get_path(empty_row))) + { + /* if so - clear name sell */ + GtkTreeIter iter; + gtk_tree_model_get_iter(model, &iter, being_edited_value); + + gtk_list_store_set ( + store, + &iter, + NAME, "", + -1); + + entering_new_var = FALSE; + } + + g_object_set (renderer_value, "editable", FALSE, NULL); + + gtk_tree_path_free(being_edited_value); +} + +/* + * env tree view name changed hadler + */ +static void on_name_changed(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer user_data) +{ + GtkTreeIter iter; + GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); + + gboolean empty = !gtk_tree_path_compare(tree_path, gtk_tree_row_reference_get_path(empty_row)); + + gtk_tree_model_get_iter ( + model, + &iter, + tree_path); + + gchar* oldvalue; + gtk_tree_model_get ( + model, + &iter, + NAME, &oldvalue, + -1); + + gchar *striped = g_strstrip(g_strdup(new_text)); + + if (!strlen(striped)) + { + /* if name is empty - offer to delete variable */ + if (!empty && dialogs_show_question(_("Delete variable?"))) + { + delete_selected_rows(); + dconfig_set_changed(); + + gtk_widget_grab_focus(tree); + } + } + else if (strcmp(oldvalue, striped)) + { + gtk_list_store_set(store, &iter, NAME, striped, -1); + if (empty) + { + /* if it was a new row - move cursor to a value cell */ + entering_new_var = TRUE; + gtk_tree_view_set_cursor_on_cell(GTK_TREE_VIEW(tree), tree_path, column_value, renderer_value, TRUE); + } + if (!empty) + { + dconfig_set_changed(); + } + } + + gtk_tree_path_free(tree_path); + g_free(oldvalue); + g_free(striped); +} + +/* + * create env tree view and return a widget + */ +GtkWidget* envtree_init() +{ + store = gtk_list_store_new ( + N_COLUMNS, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING); + model = GTK_TREE_MODEL(store); + tree = gtk_tree_view_new_with_model (model); + + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), TRUE); + g_signal_connect(G_OBJECT(tree), "key-press-event", G_CALLBACK (on_envtree_keypressed), NULL); + + renderer_name = gtk_cell_renderer_text_new (); + g_object_set (renderer_name, "editable", TRUE, NULL); + g_signal_connect (G_OBJECT (renderer_name), "edited", G_CALLBACK (on_name_changed), NULL); + column_name = gtk_tree_view_column_new_with_attributes (_("Name"), renderer_name, "text", NAME, NULL); + gtk_tree_view_column_set_resizable (column_name, TRUE); + gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column_name); + + renderer_value = gtk_cell_renderer_text_new (); + column_value = gtk_tree_view_column_new_with_attributes (_("Value"), renderer_value, "text", VALUE, NULL); + g_signal_connect (G_OBJECT (renderer_value), "edited", G_CALLBACK (on_value_changed), NULL); + g_signal_connect (G_OBJECT (renderer_value), "editing-started", G_CALLBACK (on_value_editing_started), NULL); + g_signal_connect (G_OBJECT (renderer_value), "editing-canceled", G_CALLBACK (on_value_editing_cancelled), NULL); + gtk_tree_view_column_set_cell_data_func(column_value, renderer_value, on_render_value, NULL, NULL); + gtk_tree_view_column_set_resizable (column_value, TRUE); + gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column_value); + + /* Last invisible column */ + GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); + GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes ("", renderer, "text", LAST_VISIBLE, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column); + + /* add empty row */ + add_empty_row(); + + /* set multiple selection */ + GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); + gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); + + return tree; +} + +/* + * deallocate data + */ +void envtree_destroy() +{ + gtk_tree_row_reference_free(empty_row); +} + +/* + * clear tree + */ +void envtree_clear() +{ + gtk_list_store_clear(store); + add_empty_row(); +} + +/* + * get list of environment variables + */ +GList* envpage_get_environment() +{ + GList *env = NULL; + + GtkTreeIter iter; + gtk_tree_model_get_iter_first(model, &iter); + do + { + gchar *name, *value; + gtk_tree_model_get ( + model, + &iter, + NAME, &name, + VALUE, &value, + -1); + + if (strlen(name)) + { + env = g_list_append(env, name); + env = g_list_append(env, value); + } + } + while (gtk_tree_model_iter_next(model, &iter)); + + return env; +} + +/* + * disable interacting for the time of debugging + */ +void envtree_set_readonly(gboolean readonly) +{ + g_object_set (renderer_name, "editable", !readonly, NULL); + page_read_only = readonly; +} + +/* + * add environment variable + */ +void envtree_add_environment(const gchar *name, const gchar *value) +{ + GtkTreeIter iter; + gtk_list_store_prepend(store, &iter); + gtk_list_store_set(store, &iter, NAME, name, VALUE, value, -1); +}
Property changes on: trunk/geany-plugins/debugger/src/envtree.c ___________________________________________________________________ Added: svn:executable + *
Added: trunk/geany-plugins/debugger/src/envtree.h =================================================================== --- trunk/geany-plugins/debugger/src/envtree.h (rev 0) +++ trunk/geany-plugins/debugger/src/envtree.h 2011-09-13 21:28:14 UTC (rev 2196) @@ -0,0 +1,27 @@ +/* + * envtree.h + * + * Copyright 2010 Alexander Petukhov <devel(at)apetukhov.ru> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +GtkWidget* envtree_init(); +void envtree_destroy(); +void envtree_clear(); +void envtree_set_readonly(gboolean readonly); +void envtree_add_environment(const gchar *name, const gchar *value); +GList* envpage_get_environment();
Property changes on: trunk/geany-plugins/debugger/src/envtree.h ___________________________________________________________________ Added: svn:executable + *
Modified: trunk/geany-plugins/debugger/src/plugin.c =================================================================== --- trunk/geany-plugins/debugger/src/plugin.c 2011-09-12 13:04:22 UTC (rev 2195) +++ trunk/geany-plugins/debugger/src/plugin.c 2011-09-13 21:28:14 UTC (rev 2196) @@ -39,6 +39,7 @@ #include "dconfig.h" #include "dpaned.h" #include "tabs.h" +#include "envtree.h"
/* These items are set by Geany before plugin_init() is called. */ GeanyPlugin *geany_plugin; @@ -80,6 +81,7 @@ { gboolean state = gtk_toggle_button_get_active(button); dpaned_set_tabbed(state); + tpage_pack_widgets(state); }
/* Called by Geany to initialize the plugin. @@ -107,6 +109,7 @@
/* init paned */ dpaned_init(); + tpage_pack_widgets(dpaned_get_tabbed());
GtkWidget* vbox = btnpanel_create(on_paned_mode_changed);
@@ -165,6 +168,9 @@ /* clears debug paned data */ dpaned_destroy();
+ /* clears anv tree data */ + envtree_destroy(); + /* release other allocated strings and objects */ gtk_widget_destroy(hbox); }
Modified: trunk/geany-plugins/debugger/src/tabs.c =================================================================== --- trunk/geany-plugins/debugger/src/tabs.c 2011-09-12 13:04:22 UTC (rev 2195) +++ trunk/geany-plugins/debugger/src/tabs.c 2011-09-13 21:28:14 UTC (rev 2196) @@ -140,10 +140,10 @@ label = _("Call Stack"); break; case TID_TERMINAL: - label = _("Debug terminal"); + label = _("Debug Terminal"); break; case TID_MESSAGES: - label = _("Debugger messages"); + label = _("Debugger Messages"); break; } return label;
Modified: trunk/geany-plugins/debugger/src/tpage.c =================================================================== --- trunk/geany-plugins/debugger/src/tpage.c 2011-09-12 13:04:22 UTC (rev 2195) +++ trunk/geany-plugins/debugger/src/tpage.c 2011-09-13 21:28:14 UTC (rev 2196) @@ -24,8 +24,8 @@ */
#include <string.h> + #include <gtk/gtk.h> -#include <gdk/gdkkeysyms.h>
#include <sys/stat.h>
@@ -42,377 +42,242 @@ #include "dconfig.h" #include "tpage.h" #include "tabs.h" +#include "envtree.h" +#include "gui.h"
/* boxes margins */ -#define SPACING 5 +#define SPACING 7
-/* environment variables tree view columns minumum width in characters */ -#define MW_NAME 15 -#define MW_VALUE 0 +/* root boxes border width */ +#define ROOT_BORDER_WIDTH 10
-/* environment variables tree view columns */ -enum -{ - NAME, - VALUE, - LAST_VISIBLE, - N_COLUMNS -}; +/* root boxes border width */ +#define BROWSE_BUTTON_WIDTH 65
-/* flag shows that the page is readonly (debug is running) */ -gboolean page_read_only = FALSE; +/* widgets */
-/* flag shows we entered new env variable name and now entering its value */ -gboolean entering_new_var = FALSE; +/* target */ +static GtkWidget *target_label = NULL; +static GtkWidget *target_name = NULL; +static GtkWidget *target_button_browse = NULL;
-/* reference to the env tree view empty row */ -static GtkTreeRowReference *empty_row = NULL; +/* debugger type */ +static GtkWidget *debugger_label = NULL; +static GtkWidget *debugger_cmb = NULL;
-/* target name textentry */ -static GtkWidget *targetname = NULL; +/* argments */ +static GtkWidget *args_frame = NULL; +static GtkWidget *args_textview = NULL;
-/* browse target button */ -static GtkWidget *button_browse = NULL; +/* environment variables */ +static GtkWidget *env_frame = NULL;
-/* env variables tree view */ -static GtkWidget *envtree = NULL; -static GtkTreeModel *model = NULL; -static GtkListStore *store = NULL; +/* widgets array for reference management when moving to another container */ +static GtkWidget **widgets[] = { + &target_label, &target_name, &target_button_browse, + &debugger_label, &debugger_cmb, + &args_frame, + &env_frame, + NULL +};
-static GtkTreePath *being_edited_value = NULL; - -/* debugger type combo box */ -static GtkWidget *cmb_debugger = NULL; - -/* debugger messages text view */ -GtkWidget *textview = NULL; - -/* env variable name cloumn */ -GtkTreeViewColumn *column_name = NULL; -GtkCellRenderer *renderer_name = NULL; - -/* env variable value cloumn */ -GtkTreeViewColumn *column_value = NULL; -GtkCellRenderer *renderer_value = NULL; - /* * tells config to update when target arguments change */ -void on_arguments_changed(GtkTextBuffer *textbuffer, gpointer user_data) +static void on_arguments_changed(GtkTextBuffer *textbuffer, gpointer user_data) { dconfig_set_changed(); }
/* - * delete selected rows from env variables page + * target browse button clicked handler */ -void delete_selected_rows() +static void on_target_browse_clicked(GtkButton *button, gpointer user_data) { - /* path to select after deleting finishes */ - GtkTreeRowReference *reference_to_select = NULL; - - /* empty row path */ - GtkTreePath *empty_path = gtk_tree_row_reference_get_path(empty_row); - - /* get selected rows */ - GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(envtree)); - GList *rows = gtk_tree_selection_get_selected_rows(selection, &model); - - /* check whether only empty row was selected */ - if (1 != gtk_tree_selection_count_selected_rows(selection) || - gtk_tree_path_compare((GtkTreePath*)rows->data, empty_path)) - { - /* get references to the selected rows and find out what to - select after deletion */ - GList *references = NULL; - GList *iter = rows; - while (iter) - { - GtkTreePath *path = (GtkTreePath*)iter->data; - if (!reference_to_select) - { - /* select upper sibling of the upper - selected row that has unselected upper sibling */ - GtkTreePath *sibling = gtk_tree_path_copy(path); - if(gtk_tree_path_prev(sibling)) - { - if (!gtk_tree_selection_path_is_selected(selection, sibling)) - reference_to_select = gtk_tree_row_reference_new(gtk_tree_view_get_model(GTK_TREE_VIEW(envtree)), sibling); - } - else if (gtk_tree_path_next(sibling), gtk_tree_path_compare(path, sibling)) - reference_to_select = gtk_tree_row_reference_new(gtk_tree_view_get_model(GTK_TREE_VIEW(envtree)), sibling); - } - - if (gtk_tree_path_compare(path, empty_path)) - references = g_list_append(references, gtk_tree_row_reference_new(model, path)); - - iter = iter->next; - } - - /* if all (with or without empty row) was selected - set empty row - as a path to be selected after deleting */ - if (!reference_to_select) - reference_to_select = gtk_tree_row_reference_copy (empty_row); - - iter = references; - while (iter) - { - GtkTreeRowReference *reference = (GtkTreeRowReference*)iter->data; - GtkTreePath *path = gtk_tree_row_reference_get_path(reference); - - GtkTreeIter titer; - gtk_tree_model_get_iter(model, &titer, path); - gtk_list_store_remove(store, &titer); - - iter = iter->next; - } - - /* set selection */ - gtk_tree_selection_unselect_all(selection); - GtkTreePath *path = gtk_tree_row_reference_get_path(reference_to_select); - gtk_tree_selection_select_path(selection, path); - gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(envtree), path, NULL, TRUE, 0.5, 0.5); - - /* free references list */ - g_list_foreach (references, (GFunc)gtk_tree_row_reference_free, NULL); - g_list_free (references); - } + GtkWidget *dialog; + dialog = gtk_file_chooser_dialog_new (_("Choose target file"), + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); - /* free selection reference */ - gtk_tree_row_reference_free(reference_to_select); + gchar path[FILENAME_MAX];
- /* free rows list */ - g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL); - g_list_free (rows); -} - -/* - * env tree key pressed handler - */ -gboolean on_envtree_keypressed(GtkWidget *widget, GdkEvent *event, gpointer user_data) -{ - /* do not allow deleting while debugging */ - if(page_read_only) - return FALSE; + const gchar *prevfile = gtk_entry_get_text(GTK_ENTRY(target_name)); + gchar *prevdir = g_path_get_dirname(prevfile); + if (strcmp(".", prevdir)) + strcpy(path, prevdir); + else + strcpy(path, g_path_get_dirname(DOC_FILENAME(document_get_current()))); + g_free(prevdir); - /* handling only Delete button pressing - that means "delete selected rows" */ - guint keyval = ((GdkEventKey*)event)->keyval; + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (dialog), path); - if (GDK_Delete == keyval) + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { - delete_selected_rows(); + gchar *filename; + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + gtk_entry_set_text(GTK_ENTRY(target_name), filename); + g_free (filename); + dconfig_set_changed(); } - - return GDK_Tab == keyval; + gtk_widget_destroy (dialog); }
/* - * adds empty row to env tree view + * packs widgets into page depending one tabbed mode state */ -static void add_empty_row() +void tpage_pack_widgets(gboolean tabbed) { - if (empty_row) - gtk_tree_row_reference_free(empty_row); + /* root box */ + GtkWidget *root = NULL, *oldroot = NULL; + GList *children = gtk_container_get_children(GTK_CONTAINER(tab_target)); + if (children) + { + oldroot = (GtkWidget*)children->data; + + /* unparent widgets */ + int i = 0; + while (widgets[i]) + { + g_object_ref(*widgets[i]); + gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(*widgets[i])), *widgets[i]); + i++; + } + + g_list_free(children); + } - GtkTreeIter empty; - gtk_list_store_append (store, &empty); - gtk_list_store_set (store, &empty, - NAME, "", - VALUE, "", - -1); + if (tabbed) + { + root = gtk_vbox_new(FALSE, SPACING); + gtk_container_set_border_width(GTK_CONTAINER(root), ROOT_BORDER_WIDTH); + + /* filename */ + GtkWidget *hbox = gtk_hbox_new(FALSE, SPACING); + gtk_box_pack_start(GTK_BOX(root), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), target_label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), target_name, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), target_button_browse, FALSE, FALSE, 0); + + /* lower hbox */ + hbox = gtk_hbox_new(TRUE, SPACING); + gtk_box_pack_start(GTK_BOX(root), hbox, TRUE, TRUE, 0);
- /* remeber reference */ - GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &empty); - empty_row = gtk_tree_row_reference_new(GTK_TREE_MODEL(store), path); - gtk_tree_path_free(path); -} + /* lower left and right vboxes */ + GtkWidget *lbox = gtk_vbox_new(FALSE, SPACING); + GtkWidget *rbox = gtk_vbox_new(FALSE, SPACING); + gtk_box_pack_start(GTK_BOX(hbox), lbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), rbox, TRUE, TRUE, 0);
-/* - * env tree view value column render function - */ -void on_render_value(GtkTreeViewColumn *tree_column, - GtkCellRenderer *cell, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - gpointer data) -{ - /* do not allow to edit value in read only mode */ - if (page_read_only) - g_object_set (cell, "editable", FALSE, NULL); + /* environment */ + gtk_box_pack_start(GTK_BOX(lbox), env_frame, TRUE, TRUE, 0); + + /* arguments */ + gtk_box_pack_start(GTK_BOX(rbox), args_frame, TRUE, TRUE, 0); + /* debugger type */ + hbox = gtk_hbox_new(FALSE, SPACING); + gtk_box_pack_start(GTK_BOX(hbox), debugger_label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), debugger_cmb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(rbox), hbox, FALSE, FALSE, 0); + } else { - /* do not allow to edit value for empty row */ - GtkTreePath *path = gtk_tree_model_get_path(tree_model, iter); - gboolean empty = !gtk_tree_path_compare(path, gtk_tree_row_reference_get_path(empty_row)); - g_object_set (cell, "editable", entering_new_var || !empty, NULL); - gtk_tree_path_free(path); - } -} + root = gtk_hbox_new(TRUE, SPACING); + gtk_container_set_border_width(GTK_CONTAINER(root), ROOT_BORDER_WIDTH);
-/* - * env tree view value changed hadler - */ -static void on_value_changed(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer user_data) -{ - GtkTreeIter iter; - GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); - - gboolean empty = !gtk_tree_path_compare(tree_path, gtk_tree_row_reference_get_path(empty_row)); + GtkWidget *lbox = gtk_vbox_new(FALSE, SPACING); + GtkWidget *rbox = gtk_vbox_new(FALSE, SPACING); + gtk_box_pack_start(GTK_BOX(root), lbox, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(root), rbox, TRUE, TRUE, 0);
- gtk_tree_model_get_iter ( - model, - &iter, - tree_path); - - gchar *striped = g_strstrip(g_strdup(new_text)); - - if (!strlen(striped)) - { - /* if new value is empty string, if it's a new row - do nothig - otheerwise - offer to delete a variable */ - if (empty) - gtk_list_store_set(store, &iter, NAME, "", -1); - else - { - if (dialogs_show_question(_("Delete variable?"))) - { - delete_selected_rows(); - dconfig_set_changed(); + /* environment */ + gtk_box_pack_start(GTK_BOX(lbox), env_frame, TRUE, TRUE, 0);
- gtk_widget_grab_focus(envtree); - } - } + /* target */ + GtkWidget *hbox = gtk_hbox_new(FALSE, SPACING); + gtk_box_pack_start(GTK_BOX(hbox), target_label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), target_name, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), target_button_browse, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(rbox), hbox, FALSE, FALSE, 0); + /* arguments */ + gtk_box_pack_start(GTK_BOX(rbox), args_frame, TRUE, TRUE, 0); + /* debugger type */ + hbox = gtk_hbox_new(FALSE, SPACING); + gtk_box_pack_start(GTK_BOX(hbox), debugger_label, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), debugger_cmb, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(rbox), hbox, FALSE, FALSE, 0); } - else - { - /* if old variable - change value, otherwise - add another empty row below */ - gchar* oldvalue; - gtk_tree_model_get ( - model, - &iter, - VALUE, &oldvalue, - -1);
- if (strcmp(oldvalue, striped)) + if (oldroot) + { + int i = 0; + while (widgets[i]) { - gtk_list_store_set(store, &iter, VALUE, striped, -1); - if (empty) - add_empty_row(); - - g_object_set (renderer_value, "editable", FALSE, NULL); - dconfig_set_changed(); + g_object_unref(*widgets[i]); + i++; } - - g_free(oldvalue); + gtk_container_remove(GTK_CONTAINER(tab_target), oldroot); } - - if (empty) - entering_new_var = FALSE;
- gtk_tree_path_free(tree_path); - g_free(striped); - - gtk_tree_path_free(being_edited_value); + gtk_container_add(GTK_CONTAINER(tab_target), root); + gtk_widget_show_all(tab_target); }
/* - * env tree view value editing started + * create widgets */ -void on_value_editing_started(GtkCellRenderer *renderer, GtkCellEditable *editable, gchar *path, gpointer user_data) +static void tpage_create_widgets() { - being_edited_value = gtk_tree_path_new_from_string(path); -} + /* target */ + target_label = gtk_label_new(_("Target:")); + target_name = gtk_entry_new (); + gtk_entry_set_editable(GTK_ENTRY(target_name), FALSE); + target_button_browse = create_stock_button(GTK_STOCK_OPEN, _("Browse")); + gtk_widget_set_size_request(target_button_browse, BROWSE_BUTTON_WIDTH, 0); + g_signal_connect(G_OBJECT(target_button_browse), "clicked", G_CALLBACK (on_target_browse_clicked), NULL);
-/* - * env tree view value editing cancelled (Escape pressed) - */ -void on_value_editing_cancelled(GtkCellRenderer *renderer, gpointer user_data) -{ - /* check whether escape was pressed when editing - new variable value cell */ - if(!gtk_tree_path_compare(being_edited_value, gtk_tree_row_reference_get_path(empty_row))) + /* debugger */ + debugger_label = gtk_label_new(_("Debugger:")); + debugger_cmb = gtk_combo_box_new_text(); + GList *modules = debug_get_modules(); + GList *iter = modules; + while (iter) { - /* if so - clear name sell */ - GtkTreeIter iter; - gtk_tree_model_get_iter(model, &iter, being_edited_value); - - gtk_list_store_set ( - store, - &iter, - NAME, "", - -1); - - entering_new_var = FALSE; + gtk_combo_box_append_text(GTK_COMBO_BOX(debugger_cmb), (gchar*)iter->data); + iter = iter->next; } + g_list_free(modules); + gtk_combo_box_set_active(GTK_COMBO_BOX(debugger_cmb), 0);
- g_object_set (renderer_value, "editable", FALSE, NULL); + /* arguments */ + args_frame = gtk_frame_new(_("Command Line Arguments")); + GtkWidget *hbox = gtk_hbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); + args_textview = gtk_text_view_new (); + gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(args_textview), GTK_WRAP_CHAR); + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(args_textview)); + g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK (on_arguments_changed), NULL); + gtk_container_add(GTK_CONTAINER(hbox), args_textview); + gtk_container_add(GTK_CONTAINER(args_frame), hbox);
- gtk_tree_path_free(being_edited_value); + /* environment */ + env_frame = gtk_frame_new(_("Environment Variables")); + hbox = gtk_hbox_new(FALSE, 0); + gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); + GtkWidget *tree = envtree_init(); + gtk_container_add(GTK_CONTAINER(hbox), tree); + gtk_container_add(GTK_CONTAINER(env_frame), hbox); }
/* - * env tree view name changed hadler - */ -static void on_name_changed(GtkCellRendererText *renderer, gchar *path, gchar *new_text, gpointer user_data) -{ - GtkTreeIter iter; - GtkTreePath *tree_path = gtk_tree_path_new_from_string (path); - - gboolean empty = !gtk_tree_path_compare(tree_path, gtk_tree_row_reference_get_path(empty_row)); - - gtk_tree_model_get_iter ( - model, - &iter, - tree_path); - - gchar* oldvalue; - gtk_tree_model_get ( - model, - &iter, - NAME, &oldvalue, - -1); - - gchar *striped = g_strstrip(g_strdup(new_text)); - - if (!strlen(striped)) - { - /* if name is empty - offer to delete variable */ - if (!empty && dialogs_show_question(_("Delete variable?"))) - { - delete_selected_rows(); - dconfig_set_changed(); - - gtk_widget_grab_focus(envtree); - } - } - else if (strcmp(oldvalue, striped)) - { - gtk_list_store_set(store, &iter, NAME, striped, -1); - if (empty) - { - /* if it was a new row - move cursor to a value cell */ - entering_new_var = TRUE; - gtk_tree_view_set_cursor_on_cell(GTK_TREE_VIEW(envtree), tree_path, column_value, renderer_value, TRUE); - } - if (!empty) - { - dconfig_set_changed(); - } - } - - gtk_tree_path_free(tree_path); - g_free(oldvalue); - g_free(striped); -} - -/* * set target */ void tpage_set_target(const gchar *newvalue) { - gtk_entry_set_text(GTK_ENTRY(targetname), newvalue); + gtk_entry_set_text(GTK_ENTRY(target_name), newvalue); }
/* @@ -425,7 +290,7 @@ { module = 0; } - gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_debugger), module); + gtk_combo_box_set_active(GTK_COMBO_BOX(debugger_cmb), module); }
/* @@ -433,7 +298,7 @@ */ void tpage_set_commandline(const gchar *newvalue) { - GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(args_textview)); gtk_text_buffer_set_text(buffer, newvalue, -1); }
@@ -442,9 +307,7 @@ */ void tpage_add_environment(const gchar *name, const gchar *value) { - GtkTreeIter iter; - gtk_list_store_prepend(store, &iter); - gtk_list_store_set(store, &iter, NAME, name, VALUE, value, -1); + envtree_add_environment(name, value); }
/* @@ -453,63 +316,25 @@ void tpage_clear() { /* target */ - gtk_entry_set_text(GTK_ENTRY(targetname), ""); + gtk_entry_set_text(GTK_ENTRY(target_name), ""); /* reset debugger type */ - gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_debugger), 0); + gtk_combo_box_set_active(GTK_COMBO_BOX(debugger_cmb), 0);
/* arguments */ - GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(args_textview)); gtk_text_buffer_set_text(buffer, "", -1);
/* environment variables */ - gtk_list_store_clear(store); - add_empty_row(); + envtree_clear(); }
/* - * target browse button clicked handler + * get target file names */ -void on_target_browse_clicked(GtkButton *button, gpointer user_data) -{ - GtkWidget *dialog; - dialog = gtk_file_chooser_dialog_new (_("Choose target file"), - NULL, - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, - NULL); - - gchar path[FILENAME_MAX]; - - const gchar *prevfile = gtk_entry_get_text(GTK_ENTRY(targetname)); - gchar *prevdir = g_path_get_dirname(prevfile); - if (strcmp(".", prevdir)) - strcpy(path, prevdir); - else - strcpy(path, g_path_get_dirname(DOC_FILENAME(document_get_current()))); - g_free(prevdir); - - gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER (dialog), path); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) - { - gchar *filename; - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - gtk_entry_set_text(GTK_ENTRY(targetname), filename); - g_free (filename); - - dconfig_set_changed(); - } - gtk_widget_destroy (dialog); -} - -/* - * get target file name - */ gchar* tpage_get_target() { - return g_strdup(gtk_entry_get_text(GTK_ENTRY(targetname))); + return g_strdup(gtk_entry_get_text(GTK_ENTRY(target_name))); }
/* @@ -517,7 +342,7 @@ */ int tpage_get_debug_module_index() { - return gtk_combo_box_get_active(GTK_COMBO_BOX(cmb_debugger)); + return gtk_combo_box_get_active(GTK_COMBO_BOX(debugger_cmb)); }
/* @@ -525,7 +350,7 @@ */ gchar* tpage_get_debugger() { - return gtk_combo_box_get_active_text(GTK_COMBO_BOX(cmb_debugger)); + return gtk_combo_box_get_active_text(GTK_COMBO_BOX(debugger_cmb)); }
/* @@ -534,7 +359,7 @@ gchar* tpage_get_commandline() { GtkTextIter start, end; - GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); + GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(args_textview)); gtk_text_buffer_get_start_iter(buffer, &start); gtk_text_buffer_get_end_iter(buffer, &end); @@ -553,30 +378,7 @@ */ GList* tpage_get_environment() { - GList *env = NULL; - - GtkTreeIter iter; - GtkTreeModel *_model = gtk_tree_view_get_model(GTK_TREE_VIEW(envtree)); - gtk_tree_model_get_iter_first(_model, &iter); - do - { - gchar *name, *value; - gtk_tree_model_get ( - _model, - &iter, - NAME, &name, - VALUE, &value, - -1); - - if (strlen(name)) - { - env = g_list_append(env, name); - env = g_list_append(env, value); - } - } - while (gtk_tree_model_iter_next(_model, &iter)); - - return env; + return envpage_get_environment(); }
/* @@ -584,131 +386,8 @@ */ void tpage_init() { - tab_target = gtk_hbox_new(FALSE, 0); - - GtkWidget *lbox = gtk_vbox_new(FALSE, SPACING); - GtkWidget *mbox = gtk_vbox_new(FALSE, SPACING); - - GtkWidget *hombox = gtk_hbox_new(TRUE, 0); - - /* left box */ - gtk_container_set_border_width(GTK_CONTAINER(lbox), SPACING); - - /* Target frame */ - GtkWidget *_frame = gtk_frame_new(_("Target")); - gtk_frame_set_shadow_type(GTK_FRAME(_frame), GTK_SHADOW_NONE); - GtkWidget *vbox = gtk_vbox_new(FALSE, 0); - - /* filename hbox */ - GtkWidget *hbox = gtk_hbox_new(FALSE, SPACING); - gtk_container_set_border_width(GTK_CONTAINER(hbox), SPACING); - - targetname = gtk_entry_new (); - gtk_entry_set_editable(GTK_ENTRY(targetname), FALSE); - - button_browse = gtk_button_new_with_label(_("Browse")); - g_signal_connect(G_OBJECT(button_browse), "clicked", G_CALLBACK (on_target_browse_clicked), NULL); - - gtk_box_pack_start(GTK_BOX(hbox), targetname, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(hbox), button_browse, FALSE, TRUE, 0); - - /* pack in the vertical box */ - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - - /* debugger type hbox */ - hbox = gtk_hbox_new(FALSE, SPACING); - gtk_container_set_border_width(GTK_CONTAINER(hbox), SPACING); - GtkWidget *label = gtk_label_new(_("Debugger:")); - cmb_debugger = gtk_combo_box_new_text(); - - GList *modules = debug_get_modules(); - GList *iter = modules; - while (iter) - { - gtk_combo_box_append_text(GTK_COMBO_BOX(cmb_debugger), (gchar*)iter->data); - iter = iter->next; - } - g_list_free(modules); - gtk_combo_box_set_active(GTK_COMBO_BOX(cmb_debugger), 0); - - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), cmb_debugger, TRUE, TRUE, 0); - - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - - gtk_container_add(GTK_CONTAINER(_frame), vbox); - - gtk_box_pack_start(GTK_BOX(lbox), _frame, FALSE, FALSE, 0); - - /* Arguments frame */ - _frame = gtk_frame_new(_("Arguments")); - hbox = gtk_vbox_new(FALSE, SPACING); - gtk_container_set_border_width(GTK_CONTAINER(hbox), SPACING); - - textview = gtk_text_view_new (); - gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_CHAR); - - GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); - g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK (on_arguments_changed), NULL); - - gtk_box_pack_start(GTK_BOX(hbox), textview, TRUE, TRUE, 0); - gtk_container_add(GTK_CONTAINER(_frame), hbox); - - gtk_box_pack_start(GTK_BOX(lbox), _frame, TRUE, TRUE, 0); - - - /* Environment */ - gtk_container_set_border_width(GTK_CONTAINER(mbox), SPACING); - _frame = gtk_frame_new(_("Environment variables")); - hbox = gtk_hbox_new(FALSE, SPACING); - gtk_container_set_border_width(GTK_CONTAINER(hbox), SPACING); - - store = gtk_list_store_new ( - N_COLUMNS, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING); - - model = GTK_TREE_MODEL(store); - envtree = gtk_tree_view_new_with_model (model); - gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(envtree), TRUE); - g_object_set(envtree, "rules-hint", TRUE, NULL); - g_signal_connect(G_OBJECT(envtree), "key-press-event", G_CALLBACK (on_envtree_keypressed), NULL); - - renderer_name = gtk_cell_renderer_text_new (); - g_object_set (renderer_name, "editable", TRUE, NULL); - g_signal_connect (G_OBJECT (renderer_name), "edited", G_CALLBACK (on_name_changed), NULL); - column_name = gtk_tree_view_column_new_with_attributes (_("Name"), renderer_name, "text", NAME, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (envtree), column_name); - - renderer_value = gtk_cell_renderer_text_new (); - column_name = gtk_tree_view_column_new_with_attributes (_("Value"), renderer_name, "text", VALUE, NULL); - g_signal_connect (G_OBJECT (renderer_value), "edited", G_CALLBACK (on_value_changed), NULL); - g_signal_connect (G_OBJECT (renderer_value), "editing-started", G_CALLBACK (on_value_editing_started), NULL); - g_signal_connect (G_OBJECT (renderer_value), "editing-canceled", G_CALLBACK (on_value_editing_cancelled), NULL); - gtk_tree_view_column_set_cell_data_func(column_value, renderer_value, on_render_value, NULL, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (envtree), column_value); - - /* Last invisible column */ - GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); - GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes ("", renderer, "text", LAST_VISIBLE, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (envtree), column); - - /* add empty row */ - add_empty_row(); - - /* set multiple selection */ - GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(envtree)); - gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); - - gtk_box_pack_start(GTK_BOX(hbox), envtree, TRUE, TRUE, 0); - gtk_container_add(GTK_CONTAINER(_frame), hbox); - gtk_box_pack_start(GTK_BOX(mbox), _frame, TRUE, TRUE, 0); - - - gtk_box_pack_start(GTK_BOX(hombox), lbox, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(hombox), mbox, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(tab_target), hombox, TRUE, TRUE, 0); + tab_target = gtk_vbox_new(FALSE, 0); + tpage_create_widgets(); }
/* @@ -716,10 +395,9 @@ */ void tpage_set_readonly(gboolean readonly) { - gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), !readonly); - g_object_set (renderer_name, "editable", !readonly, NULL); - gtk_widget_set_sensitive (button_browse, !readonly); - gtk_widget_set_sensitive (cmb_debugger, !readonly); - - page_read_only = readonly; + gtk_text_view_set_editable (GTK_TEXT_VIEW (args_textview), !readonly); + gtk_widget_set_sensitive (target_button_browse, !readonly); + gtk_widget_set_sensitive (debugger_cmb, !readonly); + + envtree_set_readonly(readonly); }
Modified: trunk/geany-plugins/debugger/src/tpage.h =================================================================== --- trunk/geany-plugins/debugger/src/tpage.h 2011-09-12 13:04:22 UTC (rev 2195) +++ trunk/geany-plugins/debugger/src/tpage.h 2011-09-13 21:28:14 UTC (rev 2196) @@ -38,3 +38,5 @@ void tpage_set_readonly(gboolean readonly); void tpage_clear();
+void tpage_pack_widgets(gboolean tabbed); +
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.