Commit 737f62c3 authored by Tristan Van Berkom's avatar Tristan Van Berkom

Removed submenus for the ancestry since Vincent did that magic to the


	* gladeui/glade-popup.[ch], gladeui/glade-widget.c, gladeui/glade-project-view.c: 
	  Removed submenus for the ancestry since Vincent did that magic to the project view, 
	  all is cleaner now.

	* gladeui/glade-widget-adaptor.c: Removed #include "glade-binding.h" and
	  all the scripting crap that went with it.


svn path=/trunk/; revision=1294
parent df677a7e
2007-05-02 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-popup.[ch], gladeui/glade-widget.c, gladeui/glade-project-view.c:
Removed submenus for the ancestry since Vincent did that magic to the project view,
all is cleaner now.
* gladeui/glade-widget-adaptor.c: Removed #include "glade-binding.h" and
all the scripting crap that went with it.
2007-05-01 Vincent Geddes <vincent.geddes@gmail.com>
* gladeui/glade-project-view.c: Expand and scroll to selection. Fixes #392225.
* gladeui/glade-project-view.c: Expand and scroll to selection. Fixes #392225.
2007-05-01 Tristan Van Berkom <tvb@gnome.org>
......
......@@ -174,33 +174,6 @@ glade_popup_append_item (GtkWidget *popup_menu,
return menu_item;
}
static GtkWidget *
glade_popup_create_menu (GladeWidget *widget, gboolean add_childs);
static void
glade_popup_populate_childs (GtkWidget* popup_menu, GladeWidget* parent)
{
while (parent) {
GtkWidget *child;
GtkWidget *child_menu;
GtkWidget *separator;
separator = gtk_menu_item_new ();
gtk_widget_show (separator);
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu),
separator);
child = gtk_menu_item_new_with_label (parent->name);
child_menu = glade_popup_create_menu (parent, FALSE);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (child),
child_menu);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu),
child);
parent = glade_widget_get_parent (parent);
}
}
static void
glade_popup_menuitem_activated (GtkMenuItem *item, GladeWidget *widget)
......@@ -212,12 +185,12 @@ glade_popup_menuitem_activated (GtkMenuItem *item, GladeWidget *widget)
}
static void
glade_popup_add_actions (GtkWidget *menu, GladeWidget *widget, GList *actions)
glade_popup_add_actions_recurse (GtkWidget *menu, GladeWidget *widget, GList *actions)
{
GList *list;
GtkWidget *item;
for (list = actions; list; list = g_list_next (list))
for (list = widget->adaptor->actions; list; list = g_list_next (list))
{
GWAAction *action = list->data;
GtkWidget *submenu = NULL;
......@@ -225,7 +198,7 @@ glade_popup_add_actions (GtkWidget *menu, GladeWidget *widget, GList *actions)
if (action->actions)
{
submenu = gtk_menu_new ();
glade_popup_add_actions (submenu, widget, action->actions);
glade_popup_add_actions_recurse (submenu, widget, action->actions);
}
if (action->is_a_group && submenu == NULL) continue;
......@@ -235,16 +208,34 @@ glade_popup_add_actions (GtkWidget *menu, GladeWidget *widget, GList *actions)
action->label, TRUE,
(action->is_a_group) ? NULL : glade_popup_menuitem_activated,
(action->is_a_group) ? NULL : widget);
if (action->is_a_group == FALSE)
g_object_set_data (G_OBJECT (item), "menuitem_detail", action->id);
if (submenu)
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), submenu);
}
}
static void
glade_popup_add_actions (GtkWidget *menu, GladeWidget *widget)
{
GtkWidget *separator;
if (widget->adaptor->actions)
{
separator = gtk_menu_item_new ();
gtk_widget_show (separator);
gtk_menu_shell_append (GTK_MENU_SHELL (menu),
separator);
glade_popup_add_actions_recurse (menu, widget, widget->adaptor->actions);
}
}
static GtkWidget *
glade_popup_create_menu (GladeWidget *widget, gboolean add_childs)
glade_popup_create_menu (GladeWidget *widget)
{
GtkWidget *popup_menu;
gboolean sensitive;
......@@ -265,14 +256,7 @@ glade_popup_create_menu (GladeWidget *widget, gboolean add_childs)
glade_popup_append_item (popup_menu, GTK_STOCK_DELETE, NULL, TRUE,
glade_popup_delete_cb, widget);
glade_popup_add_actions (popup_menu, widget, widget->adaptor->actions);
if (add_childs &&
!g_type_is_a (widget->adaptor->type, GTK_TYPE_WINDOW)) {
GladeWidget *parent = glade_widget_get_parent (widget);
g_return_val_if_fail (GLADE_IS_WIDGET (parent), popup_menu);
glade_popup_populate_childs(popup_menu, parent);
}
glade_popup_add_actions (popup_menu, widget);
return popup_menu;
}
......@@ -281,7 +265,6 @@ static GtkWidget *
glade_popup_create_placeholder_menu (GladePlaceholder *placeholder)
{
GtkWidget *popup_menu;
GladeWidget *parent;
gboolean sensitive;
popup_menu = gtk_menu_new ();
......@@ -290,9 +273,6 @@ glade_popup_create_placeholder_menu (GladePlaceholder *placeholder)
glade_popup_append_item (popup_menu, GTK_STOCK_PASTE, NULL, sensitive,
glade_popup_placeholder_paste_cb, placeholder);
if ((parent = glade_placeholder_get_parent (placeholder)))
glade_popup_populate_childs(popup_menu, parent);
return popup_menu;
}
......@@ -318,7 +298,7 @@ glade_popup_create_clipboard_menu (GladeWidget *widget)
}
void
glade_popup_widget_pop (GladeWidget *widget, GdkEventButton *event, gboolean add_children)
glade_popup_widget_pop (GladeWidget *widget, GdkEventButton *event)
{
GtkWidget *popup_menu;
gint button;
......@@ -326,7 +306,7 @@ glade_popup_widget_pop (GladeWidget *widget, GdkEventButton *event, gboolean add
g_return_if_fail (GLADE_IS_WIDGET (widget));
popup_menu = glade_popup_create_menu (widget, add_children);
popup_menu = glade_popup_create_menu (widget);
if (event)
{
......
......@@ -4,7 +4,7 @@
G_BEGIN_DECLS
void glade_popup_widget_pop (GladeWidget *widget, GdkEventButton *event, gboolean add_children);
void glade_popup_widget_pop (GladeWidget *widget, GdkEventButton *event);
void glade_popup_placeholder_pop (GladePlaceholder *placeholder, GdkEventButton *event);
void glade_popup_clipboard_pop (GladeWidget *widget, GdkEventButton *event);
......
......@@ -608,7 +608,7 @@ glade_project_view_button_press_cb (GtkWidget *widget,
if (widget != NULL &&
event->button == 3)
{
glade_popup_widget_pop (widget, event, FALSE);
glade_popup_widget_pop (widget, event);
handled = TRUE;
}
gtk_tree_path_free (path);
......
......@@ -29,7 +29,6 @@
#include "glade-signal.h"
#include "glade-marshallers.h"
#include "glade-accumulators.h"
#include "glade-binding.h"
/* For g_file_exists */
#include <sys/types.h>
......@@ -1449,56 +1448,6 @@ gwa_extend_with_node (GladeWidgetAdaptor *adaptor,
return TRUE;
}
static gboolean
gwa_script_item_activate_cb (GladeWidgetAdaptor *adaptor,
GladeWidget *widget,
const gchar *action_id,
GladeBindingScript *script)
{
gchar *argv[2] = {widget->name, NULL};
glade_binding_run_script (script->binding, script->path, argv);
return TRUE;
}
static void
gwa_setup_binding_scripts (GladeWidgetAdaptor *adaptor)
{
GList *l, *bindings;
if ((bindings = glade_binding_get_all ()) == NULL) return;
gwa_action_append (adaptor, NULL, "scripts", "Scripts", NULL, TRUE);
for (l = bindings; l; l = g_list_next (l))
{
GladeBinding *binding = l->data;
GList *list;
for (list = g_hash_table_lookup (binding->context_scripts, adaptor->name);
list; list = g_list_next (list))
{
GladeBindingScript *script = list->data;
gchar *detailed_signal, *name = g_strdup (script->name);
detailed_signal = g_strdup_printf ("action-activated::%s", script->name);
glade_util_replace (name, '_', ' ');
gwa_action_append (adaptor, "scripts", script->name,
name, NULL, FALSE);
g_signal_connect (adaptor, detailed_signal,
G_CALLBACK (gwa_script_item_activate_cb),
script);
g_free (name);
g_free (detailed_signal);
}
}
g_list_free (bindings);
}
/**
* create_icon_name_for_adaptor:
* @adaptor_name: The name of the widget class
......@@ -1682,8 +1631,6 @@ glade_widget_adaptor_from_catalog (GladeXmlNode *class_node,
gwa_properties_set_weight (&adaptor->properties, parent_type);
gwa_properties_set_weight (&adaptor->packing_props, parent_type);
}
gwa_setup_binding_scripts (adaptor);
glade_widget_adaptor_register (adaptor);
......
......@@ -26,6 +26,7 @@ typedef struct _GladeWidgetAdaptor GladeWidgetAdaptor;
typedef struct _GladeWidgetAdaptorPrivate GladeWidgetAdaptorPrivate;
typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
typedef struct _GladeSignalClass GladeSignalClass;
typedef struct _GWAAction GWAAction;
/**
* GWA_IS_FIXED:
......@@ -325,12 +326,15 @@ struct _GladeSignalClass
};
typedef struct _GWAAction GWAAction;
struct _GWAAction
{
gchar *id, *label, *stock;
gboolean is_a_group;
GList *actions;
gchar *id; /* The identifier of this action in the action tree */
gchar *label; /* A translated label to show in the UI for this action */
gchar *stock; /* If set, this stock item will be shown in the UI along side
* the label */
gboolean is_a_group; /* Marks whether this action is a group and can have children */
GList *actions; /* Recursive list of child actions */
};
/* Note that everything that must be processed at the creation of
......
......@@ -299,7 +299,7 @@ glade_widget_button_press_event_impl (GladeWidget *gwidget,
}
else if (event->button == 3)
{
glade_popup_widget_pop (gwidget, event, TRUE);
glade_popup_widget_pop (gwidget, event);
handled = TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment