Commit da60beee authored by Tristan Van Berkom's avatar Tristan Van Berkom

Removed notion of custom widget editors.


	* gladeui/glade-widget-adaptor.[ch], gladeui/glade-widget.[ch], gladeui/glade-editor.c,
	  gladeui/glade-xml-utils.h:
	  Removed notion of custom widget editors.

	* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: removed custom editor hooks,
	  implemented menu editor via actions only (toolbar editor temporarily disabled).


svn path=/trunk/; revision=1307
parent fb940f78
2007-05-09 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-widget-adaptor.[ch], gladeui/glade-widget.[ch], gladeui/glade-editor.c,
gladeui/glade-xml-utils.h:
Removed notion of custom widget editors.
* plugins/gtk+/gtk+.xml.in, plugins/gtk+/glade-gtk.c: removed custom editor hooks,
implemented menu editor via actions only (toolbar editor temporarily disabled).
2007-05-08 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* bindings/python/glade-python.c, gladeui/glade-binding.c,
......
......@@ -243,13 +243,6 @@ glade_editor_on_reset_click (GtkButton *button,
glade_editor_reset_dialog (editor);
}
static void
glade_editor_on_launch_click (GtkButton *button,
GladeEditor *editor)
{
glade_widget_launch_editor (editor->loaded_widget);
}
static void
glade_editor_on_docs_click (GtkButton *button,
GladeEditor *editor)
......@@ -332,15 +325,6 @@ glade_editor_init (GladeEditor *editor)
gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
gtk_box_pack_start (GTK_BOX (editor), hbox, FALSE, FALSE, 0);
/* Custom editor button */
editor->launch_button = gtk_button_new ();
label = gtk_label_new_with_mnemonic (_("_Edit..."));
gtk_misc_set_padding (GTK_MISC (label), 12, 0);
gtk_container_add (GTK_CONTAINER (editor->launch_button), label);
gtk_box_pack_start (GTK_BOX (hbox), editor->launch_button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (editor->launch_button), "clicked",
G_CALLBACK (glade_editor_on_launch_click), editor);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
/* Reset button */
......@@ -909,13 +893,6 @@ glade_editor_load_widget_real (GladeEditor *editor, GladeWidget *widget)
glade_editor_load_packing_page (editor, widget);
glade_signal_editor_load_widget (editor->signal_editor, widget);
if (widget && glade_widget_has_launcher (widget))
gtk_widget_show (editor->launch_button);
else
gtk_widget_hide (editor->launch_button);
/* we are just clearing, we are done */
if (widget == NULL)
{
......
......@@ -790,7 +790,6 @@ glade_widget_adaptor_class_init (GladeWidgetAdaptorClass *adaptor_class)
/* Class methods */
adaptor_class->post_create = NULL;
adaptor_class->launch_editor = NULL;
adaptor_class->get_internal_child = NULL;
adaptor_class->verify_property = NULL;
adaptor_class->set_property = glade_widget_adaptor_object_set_property;
......@@ -1351,10 +1350,6 @@ gwa_extend_with_node (GladeWidgetAdaptor *adaptor,
GLADE_TAG_GET_INTERNAL_CHILD_FUNCTION,
(gpointer *)&adaptor_class->get_internal_child);
glade_xml_load_sym_from_node (node, module,
GLADE_TAG_LAUNCH_EDITOR_FUNCTION,
(gpointer *)&adaptor_class->launch_editor);
glade_xml_load_sym_from_node (node, module,
GLADE_TAG_SET_FUNCTION,
(gpointer *)&adaptor_class->set_property);
......@@ -1998,28 +1993,6 @@ glade_widget_adaptor_get_internal_child (GladeWidgetAdaptor *adaptor,
return NULL;
}
/**
* glade_widget_adaptor_launch_editor:
* @adaptor: A #GladeWidgetAdaptor
* @object: The #GObject
*
* Launches a custom object editor for @object.
*/
void
glade_widget_adaptor_launch_editor (GladeWidgetAdaptor *adaptor,
GObject *object)
{
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (g_type_is_a (G_OBJECT_TYPE (object), adaptor->type));
if (GLADE_WIDGET_ADAPTOR_GET_CLASS (adaptor)->launch_editor)
GLADE_WIDGET_ADAPTOR_GET_CLASS
(adaptor)->launch_editor (adaptor, object);
else
g_critical ("No launch_editor() support in adaptor %s", adaptor->name);
}
/**
* glade_widget_adaptor_set_property:
* @adaptor: A #GladeWidgetAdaptor
......
......@@ -303,16 +303,6 @@ typedef GObject *(* GladeGetInternalFunc) (GladeWidgetAdaptor *adaptor,
const gchar *name);
/**
* GladeEditorLaunchFunc:
* @object: A #GObject
*
* Called to launch a custom editor for @object
*/
typedef void (* GladeEditorLaunchFunc) (GladeWidgetAdaptor *adaptor,
GObject *object);
/* GladeSignalClass contains all the info we need for a given signal, such as
* the signal name, and maybe more in the future
*/
......@@ -409,9 +399,6 @@ struct _GladeWidgetAdaptorClass
GladeGetInternalFunc get_internal_child; /* Retrieves the the internal child
* of the given name.
*/
GladeEditorLaunchFunc launch_editor; /* Entry point for custom editors. */
/* Delagate to verify if this is a valid value for this property,
* if this function exists and returns FALSE, then glade_property_set
......@@ -515,9 +502,6 @@ GObject *glade_widget_adaptor_get_internal_child (GladeWidgetAdaptor
GObject *object,
const gchar *internal_name);
void glade_widget_adaptor_launch_editor (GladeWidgetAdaptor *adaptor,
GObject *object);
void glade_widget_adaptor_set_property (GladeWidgetAdaptor *adaptor,
GObject *object,
const gchar *property_name,
......
......@@ -3731,59 +3731,6 @@ glade_widget_read (GladeProject *project, GladeWidgetInfo *info)
return widget;
}
/**
* glade_widget_get_launcher:
* @widget: a #GladeWidget
*
* Returns: whether there is a #GladeEditorLaunchFunc provided by
* the backend for @widget (or any of its parents)
*/
gboolean
glade_widget_has_launcher (GladeWidget *widget)
{
GladeWidget *parent;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
parent = widget;
do
{
GladeWidgetAdaptorClass *adaptor_class =
GLADE_WIDGET_ADAPTOR_GET_CLASS (parent->adaptor);
if (adaptor_class->launch_editor != NULL)
return TRUE;
} while ((parent = parent->parent) != NULL);
return FALSE;
}
/**
* glade_widget_launch_editor:
* @widget: a #GladeWidget
*
* Launches a custom editor from the backend for thie widget.
*/
void
glade_widget_launch_editor (GladeWidget *widget)
{
GladeWidget *parent;
g_return_if_fail (GLADE_IS_WIDGET (widget));
parent = widget;
do
{
GladeWidgetAdaptorClass *adaptor_class =
GLADE_WIDGET_ADAPTOR_GET_CLASS (parent->adaptor);
if (adaptor_class->launch_editor != NULL)
{
glade_widget_adaptor_launch_editor (parent->adaptor,
parent->object);
break;
}
} while ((parent = parent->parent) != NULL);
}
static gint glade_widget_su_stack = 0;
/**
......
......@@ -181,10 +181,6 @@ void glade_widget_change_signal_handler (GladeWidget *w
GPtrArray * glade_widget_list_signal_handlers (GladeWidget *widget,
const gchar *signal_name);
gboolean glade_widget_has_launcher (GladeWidget *widget);
void glade_widget_launch_editor (GladeWidget *widget);
gboolean glade_widget_has_decendant (GladeWidget *widget,
GType type);
......
......@@ -49,7 +49,6 @@ typedef struct _GladeXmlDoc GladeXmlDoc;
#define GLADE_TAG_REPLACE_CHILD_FUNCTION "replace-child-function"
#define GLADE_TAG_POST_CREATE_FUNCTION "post-create-function"
#define GLADE_TAG_GET_INTERNAL_CHILD_FUNCTION "get-internal-child-function"
#define GLADE_TAG_LAUNCH_EDITOR_FUNCTION "launch-editor-function"
#define GLADE_TAG_ADD_CHILD_FUNCTION "add-child-function"
#define GLADE_TAG_REMOVE_CHILD_FUNCTION "remove-child-function"
#define GLADE_TAG_GET_CHILDREN_FUNCTION "get-children-function"
......
......@@ -3906,10 +3906,21 @@ glade_gtk_image_set_property (GladeWidgetAdaptor *adaptor,
}
/* ----------------------------- menu callbacks ------------------------------ */
static void glade_gtk_menu_shell_launch_editor (GObject *object, gchar *title);
static gboolean
glade_gtk_menu_launch_editor_action (GladeWidget *gwidget, const gchar *data)
{
glade_widget_launch_editor (gwidget);
GladeWidget *iter = gwidget;
while (!GTK_IS_MENU_BAR (iter->object) &&
/* Make sure we support menus inside toolbars */
iter->parent && GTK_IS_MENU_SHELL (iter->parent->object))
iter = iter->parent;
glade_gtk_menu_shell_launch_editor (iter->object,
GTK_IS_MENU_BAR (iter->object) ?
_("Menu Bar Editor") : _("Menu Editor"));
return TRUE;
}
......@@ -4833,19 +4844,7 @@ glade_gtk_menu_bar_post_create (GladeWidgetAdaptor *adaptor,
glade_gtk_menu_bar_append_new_item (gsubmenu, project, "gtk-about", TRUE);
}
void
glade_gtk_menu_bar_launch_editor (GladeWidgetAdaptor *adaptor, GObject *menubar)
{
glade_gtk_menu_shell_launch_editor (menubar, _("Menu Bar Editor"));
}
/* ------------------------------ GtkMenu -------------------------------- */
void
glade_gtk_menu_launch_editor (GladeWidgetAdaptor *adaptor, GObject *menu)
{
glade_gtk_menu_shell_launch_editor (menu, _("Menu Editor"));
}
void
glade_gtk_menu_post_create (GladeWidgetAdaptor *adaptor,
GObject *object,
......@@ -5013,6 +5012,7 @@ glade_gtk_toolbar_child_selected (GladeBaseEditor *editor,
"group", "active", NULL);
}
/* XXX Must reintegrate this code with actions when ready */
void
glade_gtk_toolbar_launch_editor (GladeWidgetAdaptor *adaptor,
GObject *toolbar)
......
......@@ -301,7 +301,7 @@ embedded in another object</_tooltip>
</glade-widget-class>
<glade-widget-class name="GtkMenuItem" generic-name="menuitem" _title="Menu Item" use-placeholders="False">
<action id="launch_editor" _name="Edit Menu Bar" stock="gtk-edit"/>
<action id="launch_editor" _name="Edit Menu" stock="gtk-edit"/>
<post-create-function>glade_gtk_menu_item_post_create</post-create-function>
<get-children-function>glade_gtk_menu_item_get_children</get-children-function>
<set-property-function>glade_gtk_menu_item_set_property</set-property-function>
......@@ -367,7 +367,6 @@ embedded in another object</_tooltip>
<glade-widget-class name="GtkMenuBar" generic-name="menubar" _title="Menu Bar">
<action id="launch_editor" _name="Edit Menu Bar" stock="gtk-edit"/>
<post-create-function>glade_gtk_menu_bar_post_create</post-create-function>
<launch-editor-function>glade_gtk_menu_bar_launch_editor</launch-editor-function>
<!-- menubar is a container you can't add placeholders to it -->
<properties>
<property id="child-pack-direction">
......@@ -396,7 +395,6 @@ embedded in another object</_tooltip>
<glade-widget-class name="GtkToolbar" generic-name="toolbar" _title="Tool Bar" use-placeholders="False">
<post-create-function>empty</post-create-function>
<launch-editor-function>glade_gtk_toolbar_launch_editor</launch-editor-function>
<add-child-function>glade_gtk_toolbar_add_child</add-child-function>
<remove-child-function>glade_gtk_toolbar_remove_child</remove-child-function>
<child-set-property-function>glade_gtk_toolbar_set_child_property</child-set-property-function>
......@@ -1026,7 +1024,6 @@ embedded in another object</_tooltip>
<action id="launch_editor" _name="Edit Menu" stock="gtk-edit"/>
<!-- We do not want glade_gtk_container_post_create be executed -->
<post-create-function>glade_gtk_menu_post_create</post-create-function>
<launch-editor-function>glade_gtk_menu_launch_editor</launch-editor-function>
</glade-widget-class>
<glade-widget-class name="GtkHScrollbar" generic-name="hscrollbar" _title="Horizontal Scrollbar"/>
......
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