[glade3] 2010-03-29 Tristan Van Berkom <tvb gnome org>
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade3] 2010-03-29 Tristan Van Berkom <tvb gnome org>
- Date: Mon, 29 Mar 2010 07:57:11 +0000 (UTC)
commit 1c8096a39d962980ee07a77132fdf54a5551e794
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Mar 29 03:56:52 2010 -0400
2010-03-29 Tristan Van Berkom <tvb gnome org>
* gladeui/glade-editor-property.[ch]: Added glade_editor_property_show_object_dialog()
* gladeui/glade-signal-editor.c:
- Use glade_editor_property_show_object_dialog() to select project objects for signal user data.
- Added tooltips for the column headers
ChangeLog | 8 ++
gladeui/glade-editor-property.c | 233 +++++++++++++++++++++++++++++---------
gladeui/glade-editor-property.h | 7 +
gladeui/glade-signal-editor.c | 190 +++++++++++++++++++++++++++----
4 files changed, 358 insertions(+), 80 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4171cfc..bbdda03 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-29 Tristan Van Berkom <tvb gnome org>
+
+ * gladeui/glade-editor-property.[ch]: Added glade_editor_property_show_object_dialog()
+
+ * gladeui/glade-signal-editor.c:
+ - Use glade_editor_property_show_object_dialog() to select project objects for signal user data.
+ - Added tooltips for the column headers
+
2010-03-28 Tristan Van Berkom <tvb gnome org>
* gladeui/Makefile.am, gladeui/glade-cell-renderer-icon.[ch]: Added activatable pixbuf renderer
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index e0f902a..89a33ba 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -2454,17 +2454,10 @@ glade_eprop_object_name (const gchar *name,
}
static gboolean
-glade_eprop_object_is_selected (GladeEditorProperty *eprop,
- GladeWidget *widget)
+search_list (GList *list,
+ gpointer data)
{
- GList *list;
-
- if (GLADE_IS_PARAM_SPEC_OBJECTS (eprop->klass->pspec))
- {
- glade_property_get (eprop->property, &list);
- return g_list_find (list, widget->object) != NULL;
- }
- return glade_property_equals (eprop->property, widget->object);
+ return g_list_find (list, data) != NULL;
}
@@ -2473,11 +2466,13 @@ glade_eprop_object_is_selected (GladeEditorProperty *eprop,
* in the model are the associated GladeWidgets.
*/
static void
-glade_eprop_object_populate_view_real (GladeEditorProperty *eprop,
- GtkTreeStore *model,
- GList *widgets,
+glade_eprop_object_populate_view_real (GtkTreeStore *model,
GtkTreeIter *parent_iter,
- gboolean recurse)
+ GList *widgets,
+ GList *selected_widgets,
+ GList *exception_widgets,
+ GType object_type,
+ gboolean parentless)
{
GList *children, *list;
GtkTreeIter iter;
@@ -2490,34 +2485,14 @@ glade_eprop_object_populate_view_real (GladeEditorProperty *eprop,
if ((widget = glade_widget_get_from_gobject (list->data)) != NULL)
{
- if (GLADE_IS_PARAM_SPEC_OBJECTS (eprop->klass->pspec))
- {
- has_decendant = recurse && glade_widget_has_decendant
- (widget,
- glade_param_spec_objects_get_type
- (GLADE_PARAM_SPEC_OBJECTS(eprop->klass->pspec)));
- good_type =
- g_type_is_a
- (widget->adaptor->type,
- glade_param_spec_objects_get_type
- (GLADE_PARAM_SPEC_OBJECTS(eprop->klass->pspec))) ||
- glade_util_class_implements_interface
- (widget->adaptor->type,
- glade_param_spec_objects_get_type
- (GLADE_PARAM_SPEC_OBJECTS(eprop->klass->pspec)));
-
- }
- else
- {
- has_decendant = recurse && glade_widget_has_decendant
- (widget, eprop->klass->pspec->value_type);
+ has_decendant = !parentless && glade_widget_has_decendant
+ (widget, object_type);
- good_type = g_type_is_a (widget->adaptor->type,
- eprop->klass->pspec->value_type);
+ good_type = (widget->adaptor->type == object_type ||
+ g_type_is_a (widget->adaptor->type, object_type) ||
+ glade_util_class_implements_interface (widget->adaptor->type, object_type));
- }
-
- if (eprop->klass->parentless_widget)
+ if (parentless)
good_type = good_type && !GWA_IS_TOPLEVEL (widget->adaptor);
if (good_type || has_decendant)
@@ -2534,10 +2509,10 @@ glade_eprop_object_populate_view_real (GladeEditorProperty *eprop,
* its not itself.
*/
OBJ_COLUMN_SELECTABLE,
- good_type && (widget != eprop->property->widget),
+ good_type && !search_list (exception_widgets, widget),
OBJ_COLUMN_SELECTED,
- good_type && glade_eprop_object_is_selected
- (eprop, widget), -1);
+ good_type && search_list (selected_widgets, widget),
+ -1);
}
if (has_decendant &&
@@ -2547,7 +2522,10 @@ glade_eprop_object_populate_view_real (GladeEditorProperty *eprop,
GtkTreeIter *copy = NULL;
copy = gtk_tree_iter_copy (&iter);
- glade_eprop_object_populate_view_real (eprop, model, children, copy, recurse);
+ glade_eprop_object_populate_view_real (model, copy, children,
+ selected_widgets,
+ exception_widgets,
+ object_type, parentless);
gtk_tree_iter_free (copy);
g_list_free (children);
@@ -2557,11 +2535,14 @@ glade_eprop_object_populate_view_real (GladeEditorProperty *eprop,
}
static void
-glade_eprop_object_populate_view (GladeEditorProperty *eprop,
- GtkTreeView *view)
+glade_eprop_object_populate_view (GladeProject *project,
+ GtkTreeView *view,
+ GList *selected,
+ GList *exceptions,
+ GType object_type,
+ gboolean parentless)
{
GtkTreeStore *model = (GtkTreeStore *)gtk_tree_view_get_model (view);
- GladeProject *project = glade_app_get_project ();
GList *list, *toplevels = NULL;
/* Make a list of only the toplevel widgets */
@@ -2576,7 +2557,9 @@ glade_eprop_object_populate_view (GladeEditorProperty *eprop,
}
/* add the widgets and recurse */
- glade_eprop_object_populate_view_real (eprop, model, toplevels, NULL, !eprop->klass->parentless_widget);
+ glade_eprop_object_populate_view_real (model, NULL, toplevels, selected, exceptions,
+ object_type,
+ parentless);
g_list_free (toplevels);
}
@@ -2641,8 +2624,7 @@ glade_eprop_object_selected (GtkCellRendererToggle *cell,
}
static GtkWidget *
-glade_eprop_object_view (GladeEditorProperty *eprop,
- gboolean radio)
+glade_eprop_object_view (gboolean radio)
{
GtkWidget *view_widget;
GtkTreeModel *model;
@@ -2749,6 +2731,118 @@ glade_eprop_object_dialog_title (GladeEditorProperty *eprop)
(eprop->klass->pspec->value_type));
}
+
+gboolean
+glade_editor_property_show_object_dialog (GladeProject *project,
+ const gchar *title,
+ GtkWidget *parent,
+ GType object_type,
+ GladeWidget *exception,
+ GladeWidget **object)
+{
+ GtkWidget *dialog;
+ GtkWidget *vbox, *label, *sw;
+ GtkWidget *tree_view;
+ GtkWidget *content_area;
+ GtkWidget *action_area;
+ GList *selected_list = NULL, *exception_list = NULL;
+ gint res;
+
+ g_return_val_if_fail (object != NULL, -1);
+
+ if (!parent)
+ parent = glade_app_get_window ();
+
+ dialog = gtk_dialog_new_with_buttons (title,
+ GTK_WINDOW (parent),
+ GTK_DIALOG_MODAL,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_CLEAR, GLADE_RESPONSE_CLEAR,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+
+ gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
+ GTK_RESPONSE_OK,
+ GTK_RESPONSE_CANCEL,
+ GLADE_RESPONSE_CLEAR,
+ -1);
+
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ /* HIG settings */
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
+ action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
+
+ vbox = gtk_vbox_new (FALSE, 6);
+ gtk_widget_show (vbox);
+
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+
+ gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
+
+ /* Checklist */
+ label = gtk_label_new_with_mnemonic (_("O_bjects:"));
+ gtk_widget_show (label);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_show (sw);
+ gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
+ gtk_widget_set_size_request (sw, 400, 200);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
+
+
+ if (*object)
+ selected_list = g_list_prepend (selected_list, *object);
+
+ if (exception)
+ exception_list = g_list_prepend (exception_list, exception);
+
+ tree_view = glade_eprop_object_view (TRUE);
+ glade_eprop_object_populate_view (project,
+ GTK_TREE_VIEW (tree_view),
+ selected_list, exception_list,
+ object_type, FALSE);
+ g_list_free (selected_list);
+ g_list_free (exception_list);
+
+ gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
+
+ gtk_widget_show (tree_view);
+ gtk_container_add (GTK_CONTAINER (sw), tree_view);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), tree_view);
+
+ /* Run the dialog */
+ res = gtk_dialog_run (GTK_DIALOG (dialog));
+ if (res == GTK_RESPONSE_OK)
+ {
+ GladeWidget *selected = NULL;
+
+ gtk_tree_model_foreach
+ (gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)),
+ (GtkTreeModelForeachFunc)
+ glade_eprop_object_selected_widget, &selected);
+
+ *object = selected;
+ }
+ else if (res == GLADE_RESPONSE_CLEAR)
+ *object = NULL;
+
+ gtk_widget_destroy (dialog);
+
+ return (res == GTK_RESPONSE_OK || res == GLADE_RESPONSE_CLEAR);
+}
+
+
static void
glade_eprop_object_show_dialog (GtkWidget *dialog_button,
GladeEditorProperty *eprop)
@@ -2762,6 +2856,7 @@ glade_eprop_object_show_dialog (GtkWidget *dialog_button,
gchar *title = glade_eprop_object_dialog_title (eprop);
gint res;
GladeWidgetAdaptor *create_adaptor = NULL;
+ GList *selected_list = NULL, *exception_list = NULL;
project = glade_widget_get_project (eprop->property->widget);
parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
@@ -2847,8 +2942,19 @@ glade_eprop_object_show_dialog (GtkWidget *dialog_button,
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
- tree_view = glade_eprop_object_view (eprop, TRUE);
- glade_eprop_object_populate_view (eprop, GTK_TREE_VIEW (tree_view));
+ exception_list = g_list_prepend (exception_list, eprop->property->widget);
+ if (g_value_get_object (eprop->property->value))
+ selected_list = g_list_prepend (selected_list,
+ glade_widget_get_from_gobject
+ (g_value_get_object (eprop->property->value)));
+
+ tree_view = glade_eprop_object_view (TRUE);
+ glade_eprop_object_populate_view (project, GTK_TREE_VIEW (tree_view),
+ selected_list, exception_list,
+ eprop->klass->pspec->value_type,
+ eprop->klass->parentless_widget);
+ g_list_free (selected_list);
+ g_list_free (exception_list);
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
@@ -3092,7 +3198,7 @@ glade_eprop_objects_show_dialog (GtkWidget *dialog_button,
GladeProject *project;
gchar *title = glade_eprop_object_dialog_title (eprop);
gint res;
-
+ GList *selected_list = NULL, *exception_list = NULL, *selected_objects = NULL;
project = glade_widget_get_project (eprop->property->widget);
parent = gtk_widget_get_toplevel (GTK_WIDGET (eprop));
@@ -3129,8 +3235,25 @@ glade_eprop_objects_show_dialog (GtkWidget *dialog_button,
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
- tree_view = glade_eprop_object_view (eprop, FALSE);
- glade_eprop_object_populate_view (eprop, GTK_TREE_VIEW (tree_view));
+ tree_view = glade_eprop_object_view (FALSE);
+
+
+ exception_list = g_list_prepend (exception_list, eprop->property->widget);
+
+ if (g_value_get_object (eprop->property->value))
+ {
+ GList *l;
+ glade_property_get (eprop->property, &selected_objects);
+ for (l = selected_objects; l; l = l->next)
+ selected_list = g_list_prepend (selected_list,
+ glade_widget_get_from_gobject (l->data));
+ }
+ glade_eprop_object_populate_view (project, GTK_TREE_VIEW (tree_view),
+ selected_list, exception_list,
+ eprop->klass->pspec->value_type,
+ eprop->klass->parentless_widget);
+ g_list_free (selected_list);
+ g_list_free (exception_list);
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
diff --git a/gladeui/glade-editor-property.h b/gladeui/glade-editor-property.h
index ee7811d..7f961cf 100644
--- a/gladeui/glade-editor-property.h
+++ b/gladeui/glade-editor-property.h
@@ -158,6 +158,13 @@ gboolean glade_editor_property_show_resource_dialog (GladeProject
GtkWidget *parent,
gchar **filename);
+gboolean glade_editor_property_show_object_dialog (GladeProject *project,
+ const gchar *title,
+ GtkWidget *parent,
+ GType object_type,
+ GladeWidget *exception,
+ GladeWidget **object);
+
/* Generic eprops */
#define GLADE_TYPE_EPROP_NUMERIC (glade_eprop_numeric_get_type())
#define GLADE_TYPE_EPROP_ENUM (glade_eprop_enum_get_type())
diff --git a/gladeui/glade-signal-editor.c b/gladeui/glade-signal-editor.c
index 0cb00b7..a5dd04e 100644
--- a/gladeui/glade-signal-editor.c
+++ b/gladeui/glade-signal-editor.c
@@ -75,14 +75,14 @@ G_DEFINE_TYPE (GladeSignalEditor, glade_signal_editor, G_TYPE_OBJECT)
#define HANDLER_DEFAULT _("<Type here>")
-#define USERDATA_DEFAULT HANDLER_DEFAULT
+#define USERDATA_DEFAULT _("<Object>")
static gboolean
is_void_handler (const gchar *signal_handler)
{
return ( signal_handler == NULL ||
*signal_handler == 0 ||
- g_utf8_collate (signal_handler, _(HANDLER_DEFAULT)) == 0);
+ g_utf8_collate (signal_handler, HANDLER_DEFAULT) == 0);
}
static gboolean
@@ -90,7 +90,7 @@ is_void_userdata (const gchar *user_data)
{
return ( user_data == NULL ||
*user_data == 0 ||
- g_utf8_collate (user_data, _(USERDATA_DEFAULT)) == 0);
+ g_utf8_collate (user_data, USERDATA_DEFAULT) == 0);
}
static void
@@ -168,8 +168,8 @@ append_slot (GtkTreeModel *model, GtkTreeIter *iter_signal)
gtk_tree_store_append (GTK_TREE_STORE (model), &iter_new_slot, iter_signal);
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_new_slot,
- GSE_COLUMN_HANDLER, _(HANDLER_DEFAULT),
- GSE_COLUMN_USERDATA, _(USERDATA_DEFAULT),
+ GSE_COLUMN_HANDLER, HANDLER_DEFAULT,
+ GSE_COLUMN_USERDATA, USERDATA_DEFAULT,
GSE_COLUMN_SWAPPED, FALSE,
GSE_COLUMN_SWAPPED_VISIBLE, FALSE,
GSE_COLUMN_HANDLER_EDITABLE, TRUE,
@@ -335,9 +335,9 @@ glade_signal_editor_handler_editing_done_impl (GladeSignalEditor *self,
gtk_tree_store_set
(GTK_TREE_STORE (model), iter,
- GSE_COLUMN_HANDLER, _(HANDLER_DEFAULT),
+ GSE_COLUMN_HANDLER, HANDLER_DEFAULT,
GSE_COLUMN_AFTER, FALSE,
- GSE_COLUMN_USERDATA, _(USERDATA_DEFAULT),
+ GSE_COLUMN_USERDATA, USERDATA_DEFAULT,
GSE_COLUMN_SWAPPED, FALSE,
GSE_COLUMN_SWAPPED_VISIBLE, FALSE,
GSE_COLUMN_HANDLER_EDITABLE, TRUE,
@@ -411,7 +411,7 @@ glade_signal_editor_userdata_editing_done_impl (GladeSignalEditor *self,
{
gtk_tree_store_set (GTK_TREE_STORE (model), iter,
GSE_COLUMN_USERDATA_SLOT, TRUE,
- GSE_COLUMN_USERDATA, _(USERDATA_DEFAULT),
+ GSE_COLUMN_USERDATA, USERDATA_DEFAULT,
GSE_COLUMN_SWAPPED, FALSE,
GSE_COLUMN_SWAPPED_VISIBLE, FALSE, -1);
}
@@ -656,7 +656,115 @@ glade_signal_editor_devhelp_cb (GtkCellRenderer *cell,
g_free (book);
g_free (signal);
}
+
+static void
+set_column_header_tooltip_on_realize (GtkWidget *label,
+ const gchar *tooltip_txt)
+{
+ GtkWidget *header =
+ gtk_widget_get_ancestor (label, GTK_TYPE_BUTTON);
+
+ if (header)
+ gtk_widget_set_tooltip_text (header, tooltip_txt);
+}
+
+/* convenience function: tooltip_txt must be static memory */
+static void
+column_header_widget (GtkTreeViewColumn *column,
+ const gchar *txt,
+ const gchar *tooltip_txt)
+{
+ GtkWidget *event_box, *label;
+
+ event_box = gtk_event_box_new ();
+ gtk_widget_set_tooltip_text (event_box, tooltip_txt);
+
+ label = gtk_label_new (txt);
+ gtk_misc_set_padding (GTK_MISC (label), 5, 0);
+
+ gtk_widget_show (event_box);
+ gtk_widget_show (label);
+
+ g_signal_connect_after (G_OBJECT (label), "realize",
+ G_CALLBACK (set_column_header_tooltip_on_realize), (gpointer)tooltip_txt);
+
+ gtk_container_add (GTK_CONTAINER (event_box), label);
+
+ gtk_tree_view_column_set_widget (column, event_box);
+}
+
+static void
+glade_signal_editor_user_data_activate (GtkCellRenderer *icon_renderer,
+ const gchar *path_str,
+ GladeSignalEditor *editor)
+{
+ GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+ GtkTreeModel *model = GTK_TREE_MODEL (editor->model);
+ GtkTreeIter iter;
+ gchar *object_name = NULL, *signal_name = NULL, *handler = NULL;
+ gboolean after, swapped;
+ GladeWidget *project_object = NULL;
+ GladeProject *project;
+ GList *selected = NULL, *exception = NULL;
+
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter,
+ GSE_COLUMN_SIGNAL, &signal_name,
+ GSE_COLUMN_HANDLER, &handler,
+ GSE_COLUMN_USERDATA,&object_name,
+ GSE_COLUMN_SWAPPED, &swapped,
+ GSE_COLUMN_AFTER, &after, -1);
+
+ project = glade_widget_get_project (editor->widget);
+ if (object_name)
+ {
+ project_object = glade_project_get_widget_by_name (project, NULL, object_name);
+ selected = g_list_prepend (selected, project_object);
+ }
+
+ exception = g_list_prepend (exception, editor->widget);
+
+ if (glade_editor_property_show_object_dialog (project,
+ _("Select an object to pass to the handler"),
+ gtk_widget_get_toplevel (editor->main_window),
+ G_TYPE_OBJECT,
+ editor->widget, &project_object))
+ {
+ GladeSignal *old_signal = glade_signal_new (signal_name, handler, object_name, after, swapped);
+ GladeSignal *new_signal = glade_signal_new (signal_name, handler,
+ project_object ? project_object->name : NULL,
+ after, swapped);
+
+ glade_command_change_signal (editor->widget, old_signal, new_signal);
+ glade_signal_free (old_signal);
+ glade_signal_free (new_signal);
+
+ /* We are removing userdata */
+ if (project_object == NULL)
+ {
+ gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
+ GSE_COLUMN_USERDATA_SLOT, TRUE,
+ GSE_COLUMN_USERDATA, USERDATA_DEFAULT,
+ GSE_COLUMN_SWAPPED, FALSE,
+ GSE_COLUMN_SWAPPED_VISIBLE, FALSE, -1);
+ }
+ else
+ {
+ gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
+ GSE_COLUMN_USERDATA_SLOT, FALSE,
+ GSE_COLUMN_USERDATA, project_object->name,
+ GSE_COLUMN_SWAPPED_VISIBLE, TRUE,
+ -1);
+ }
+ }
+
+ gtk_tree_path_free (path);
+ g_free (signal_name);
+ g_free (object_name);
+ g_free (handler);
+}
+
void
glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
@@ -696,7 +804,10 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
/************************ signal column ************************/
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes
- (_("Signal"), renderer, "text", GSE_COLUMN_SIGNAL, NULL);
+ (NULL, renderer, "text", GSE_COLUMN_SIGNAL, NULL);
+
+ column_header_widget (column, _("Signal"), _("The name of the signal to connect to"));
+
gtk_tree_view_column_set_cell_data_func (column, renderer,
glade_signal_editor_signal_cell_data_func,
NULL, NULL);
@@ -725,9 +836,12 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
if (!editor->handler_column)
{
editor->handler_column = gtk_tree_view_column_new_with_attributes
- (_("Handler"), editor->handler_renderer,
- "text", GSE_COLUMN_HANDLER,
- "editable", GSE_COLUMN_HANDLER_EDITABLE, NULL);
+ (NULL, editor->handler_renderer,
+ "editable", GSE_COLUMN_HANDLER_EDITABLE,
+ "text", GSE_COLUMN_HANDLER, NULL);
+
+ column_header_widget (editor->handler_column, _("Handler"),
+ _("Enter the handler to run for this signal"));
gtk_tree_view_column_set_cell_data_func (editor->handler_column, editor->handler_renderer,
glade_signal_editor_handler_cell_data_func,
@@ -752,18 +866,37 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
g_signal_connect (editor->userdata_renderer, "editing-started",
G_CALLBACK (glade_signal_editor_userdata_editing_started),
editor);
-
+
if (!editor->userdata_column)
{
editor->userdata_column =
gtk_tree_view_column_new_with_attributes
- (_("Object"), editor->userdata_renderer,
- "text", GSE_COLUMN_USERDATA,
- "editable", GSE_COLUMN_USERDATA_EDITABLE, NULL);
+ (NULL, editor->userdata_renderer,
+ "text", GSE_COLUMN_USERDATA, NULL);
+
+ column_header_widget (editor->userdata_column, _("Object"),
+ _("An object to pass to the handler"));
gtk_tree_view_column_set_cell_data_func (editor->userdata_column, editor->userdata_renderer,
glade_signal_editor_userdata_cell_data_func,
NULL, NULL);
+
+ g_object_set (G_OBJECT (editor->userdata_renderer),
+ "editable", FALSE,
+ "ellipsize", PANGO_ELLIPSIZE_END,
+ "width-chars", 10,
+ NULL);
+
+ renderer = glade_cell_renderer_icon_new ();
+ g_object_set (G_OBJECT (renderer), "icon-name", GTK_STOCK_EDIT, NULL);
+
+ g_signal_connect (G_OBJECT (renderer), "activate",
+ G_CALLBACK (glade_signal_editor_user_data_activate), editor);
+ gtk_tree_view_column_pack_end (editor->userdata_column, renderer, FALSE);
+ gtk_tree_view_column_set_attributes (editor->userdata_column, renderer,
+ "activatable", GSE_COLUMN_USERDATA_EDITABLE,
+ "visible", GSE_COLUMN_USERDATA_EDITABLE,
+ NULL);
}
gtk_tree_view_column_set_expand (editor->userdata_column, TRUE);
@@ -774,20 +907,23 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
g_signal_connect (renderer, "toggled",
G_CALLBACK (glade_signal_editor_after_swapped_toggled), editor);
column = gtk_tree_view_column_new_with_attributes
- (_("Swapped"), renderer,
+ (NULL, renderer,
"active", GSE_COLUMN_SWAPPED,
"sensitive", GSE_COLUMN_SWAPPED_VISIBLE,
"activatable", GSE_COLUMN_SWAPPED_VISIBLE,
"visible", GSE_COLUMN_CONTENT,
NULL);
+ column_header_widget (column,_("Swapped"),
+ _("Whether the instance and object should be swapped when calling the handler"));
+
gtk_tree_view_append_column (view, column);
/************************ after column ************************/
renderer = gtk_cell_renderer_toggle_new ();
g_object_set (G_OBJECT (renderer),
- "width", 20,
+ "xpad", 15,
NULL);
g_object_set_data (G_OBJECT (renderer), "signal-after-cell",
GINT_TO_POINTER (TRUE));
@@ -795,13 +931,17 @@ glade_signal_editor_construct_signals_list (GladeSignalEditor *editor)
g_signal_connect (renderer, "toggled",
G_CALLBACK (glade_signal_editor_after_swapped_toggled), editor);
column = gtk_tree_view_column_new_with_attributes
- (_("After"), renderer,
+ (NULL, renderer,
"active", GSE_COLUMN_AFTER,
"sensitive", GSE_COLUMN_AFTER_VISIBLE,
"activatable", GSE_COLUMN_AFTER_VISIBLE,
"visible", GSE_COLUMN_CONTENT,
NULL);
+ column_header_widget (column, _("After"),
+ _("Whether the handler should be called before "
+ "or after the default handler of the signal"));
+
/* Append the devhelp icon if we have it */
if (glade_util_have_devhelp ())
{
@@ -961,9 +1101,9 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
gtk_tree_store_set
(editor->model, &parent_signal,
GSE_COLUMN_SIGNAL, signal->name,
- GSE_COLUMN_HANDLER, _(HANDLER_DEFAULT),
+ GSE_COLUMN_HANDLER, HANDLER_DEFAULT,
GSE_COLUMN_AFTER, FALSE,
- GSE_COLUMN_USERDATA, _(USERDATA_DEFAULT),
+ GSE_COLUMN_USERDATA, USERDATA_DEFAULT,
GSE_COLUMN_SWAPPED, FALSE,
GSE_COLUMN_SWAPPED_VISIBLE, FALSE,
GSE_COLUMN_HANDLER_EDITABLE, TRUE,
@@ -998,7 +1138,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
GSE_COLUMN_AFTER, widget_signal->after,
GSE_COLUMN_USERDATA,
widget_signal->userdata ?
- widget_signal->userdata : _(USERDATA_DEFAULT),
+ widget_signal->userdata : USERDATA_DEFAULT,
GSE_COLUMN_SWAPPED, widget_signal->swapped,
GSE_COLUMN_SWAPPED_VISIBLE,
widget_signal->userdata ? TRUE : FALSE,
@@ -1023,7 +1163,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
GSE_COLUMN_AFTER, widget_signal->after,
GSE_COLUMN_USERDATA,
widget_signal->userdata ?
- widget_signal->userdata : _(USERDATA_DEFAULT),
+ widget_signal->userdata : USERDATA_DEFAULT,
GSE_COLUMN_SWAPPED, widget_signal->swapped,
GSE_COLUMN_SWAPPED_VISIBLE,
widget_signal->userdata ? TRUE : FALSE,
@@ -1041,9 +1181,9 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
gtk_tree_store_append (editor->model, &iter, &parent_signal);
gtk_tree_store_set
(editor->model, &iter,
- GSE_COLUMN_HANDLER, _(HANDLER_DEFAULT),
+ GSE_COLUMN_HANDLER, HANDLER_DEFAULT,
GSE_COLUMN_AFTER, FALSE,
- GSE_COLUMN_USERDATA, _(USERDATA_DEFAULT),
+ GSE_COLUMN_USERDATA, USERDATA_DEFAULT,
GSE_COLUMN_SWAPPED, FALSE,
GSE_COLUMN_SWAPPED_VISIBLE, FALSE,
GSE_COLUMN_HANDLER_EDITABLE, TRUE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]