Commit 0c4e3578 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte

added files glade-base-editor.[ch]

	* src/Makefile.am: added files glade-base-editor.[ch]

	* src/glade-accumulators.[ch]: new accumulators
	  glade_string_accumulator() and glade_stop_emission_accumulator ()

	* src/glade-app.c, src/glade-project.c and src/glade-command.c:
	  use of GladeWidgetClass toplevel flag.

	* src/glade-gtk.c: Use of GladeBaseEditor for GtkMenuBar, GtkToolBar
	  and GtkMenu editors.

	* src/glade-marshallers.list: added OBJECT:OBJECT,UINT
	  BOOLEAN:OBJECT,UINT BOOLEAN:OBJECT,OBJECT and STRING:OBJECT

	* src/glade-property.[ch]: Added old_value parameter to GladeProject
	  "value_changed" signal.

	* src/glade-widget-class.[ch]: added toplevel flag to GladeWidgetClass

	* src/glade.h: added GLADE_XML_TAG_TOPLEVEL

	* src/glade-base-editor.[ch]: Created GladeBaseEditor class from
	  GtkMenuBarEditor code from glade-gtk.c

	* widgets/gtk+.xml.in:
	  o added launch-editor-function for GtkToolbar and GtkMenu.
	  o Set GtkTextView post-create-function to empty (we do not need a
	    placeholder in it).
	  o Set toplevel="True" in GtkWindow and GtkMenu.

	* doc/widgetclasses.sgml: added toplevel property docs

	* po/POTFILES.in: added src/glade-base-editor.c
parent 8ce781c1
2006-07-13 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* src/Makefile.am: added files glade-base-editor.[ch]
* src/glade-accumulators.[ch]: new accumulators
glade_string_accumulator() and glade_stop_emission_accumulator ()
* src/glade-app.c, src/glade-project.c and src/glade-command.c:
use of GladeWidgetClass toplevel flag.
* src/glade-gtk.c: Use of GladeBaseEditor for GtkMenuBar, GtkToolBar
and GtkMenu editors.
* src/glade-marshallers.list: added OBJECT:OBJECT,UINT
BOOLEAN:OBJECT,UINT BOOLEAN:OBJECT,OBJECT and STRING:OBJECT
* src/glade-property.[ch]: Added old_value parameter to GladeProject
"value_changed" signal.
* src/glade-widget-class.[ch]: added toplevel flag to GladeWidgetClass
* src/glade.h: added GLADE_XML_TAG_TOPLEVEL
* src/glade-base-editor.[ch]: Created GladeBaseEditor class from
GtkMenuBarEditor code from glade-gtk.c
* widgets/gtk+.xml.in:
o added launch-editor-function for GtkToolbar and GtkMenu.
o Set GtkTextView post-create-function to empty (we do not need a
placeholder in it).
o Set toplevel="True" in GtkWindow and GtkMenu.
* doc/widgetclasses.sgml: added toplevel property docs
* po/POTFILES.in: added src/glade-base-editor.c
2006-07-06 Vincent Geddes <vgeddes@metroweb.co.za>
* pixmaps/16x16/Makefile.am, pixmaps/22x22/Makefile.am:
......
......@@ -2,9 +2,7 @@
Tasks/Bugs Blocking glade-3 3.0:
================================
o Toolbar editor / Popup menu editor (Juan Pablo: working on it)
o Implement GnomeDB widget catalog. (Daniel)
o DevHelp gets spawned with version 0.11 (bug 344043)
o Default notebook tab labels (bug 345438) (Tristan)
o GtkButton saves a previously set label when later set to container mode (bug 346139)
......@@ -85,6 +85,16 @@ tree and will be translated before use in the interface.
</listitem>
</varlistentry>
<varlistentry>
<term>toplevel</term>
<listitem>
<para>
The'toplevel' property is used to know whether this widget class is toplevel or not
in Glade context.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>post-create-function</term>
<listitem>
......
......@@ -9,6 +9,7 @@ src/glade-project-window.c
# libgladeui shared core library
src/glade-app.c
src/glade-builtins.c
src/glade-base-editor.c
src/glade-catalog.c
src/glade-clipboard-view.c
src/glade-clipboard.c
......@@ -44,4 +45,3 @@ src/glade-gnome.c
widgets/gnome.xml.in
widgets/bonobo.xml.in
widgets/canvas.xml.in
......@@ -85,7 +85,8 @@ libgladeui_1_la_SOURCES = \
glade-builtins.c \
glade-app.c \
glade-keysyms.c \
glade-fixed.c
glade-fixed.c \
glade-base-editor.c
libgladeui_1_la_CFLAGS = \
-DINSIDE_LIBGLADEUI \
......@@ -133,6 +134,7 @@ libgladeuiinclude_HEADERS = \
glade-app.h \
glade-builtins.h \
glade-fixed.h \
glade-base-editor.h \
fixed_bg.xpm \
atk.xpm
......
......@@ -53,3 +53,30 @@ glade_boolean_handled_accumulator (GSignalInvocationHint *ihint,
return continue_emission;
}
gboolean
glade_string_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy)
{
const gchar *handler_str;
g_free ((void *)g_value_get_string (return_accu));
handler_str = g_value_get_string (handler_return);
g_value_set_string (return_accu, handler_str);
return (handler_str == NULL);
}
gboolean
glade_stop_emission_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy)
{
g_value_copy (handler_return, return_accu);
return FALSE;
}
......@@ -6,17 +6,25 @@
G_BEGIN_DECLS
gboolean glade_single_object_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
gboolean glade_single_object_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
gboolean glade_boolean_handled_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
gboolean glade_string_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
gboolean glade_stop_emission_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
G_END_DECLS
#endif /* __GLADE_ACCUM_H__ */
......@@ -271,7 +271,7 @@ on_palette_button_clicked (GladePalette *palette, GladeApp *app)
class = glade_palette_get_current_item_class (palette);
/* class may be NULL if the selector was pressed */
if (class && g_type_is_a (class->type, GTK_TYPE_WINDOW))
if (class && class->toplevel)
{
widget = glade_command_create (class, NULL, NULL, app->priv->active_project);
......
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2006 Juan Pablo Ugarte.
*
* 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.
*
* Authors:
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
*/
#ifndef __GLADE_BASE_EDITOR_H__
#define __GLADE_BASE_EDITOR_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "glade-widget.h"
#include "glade-marshallers.h"
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GLADE_TYPE_BASE_EDITOR (glade_base_editor_get_type ())
#define GLADE_BASE_EDITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GLADE_TYPE_BASE_EDITOR, GladeBaseEditor))
#define GLADE_BASE_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GLADE_TYPE_BASE_EDITOR, GladeBaseEditorClass))
#define GLADE_IS_BASE_EDITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GLADE_TYPE_BASE_EDITOR))
#define GLADE_IS_BASE_EDITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GLADE_TYPE_BASE_EDITOR))
#define GLADE_BASE_EDITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_TYPE_BASE_EDITOR, GladeBaseEditorClass))
typedef struct _GladeBaseEditor GladeBaseEditor;
typedef struct _GladeBaseEditorPrivate GladeBaseEditorPrivate;
typedef struct _GladeBaseEditorClass GladeBaseEditorClass;
struct _GladeBaseEditor
{
GtkVBox parent;
GladeBaseEditorPrivate *priv;
};
struct _GladeBaseEditorClass
{
GtkVBoxClass parent_class;
void (*child_selected) (GladeBaseEditor *, GladeWidget *);
gboolean (*change_type) (GladeBaseEditor *, GladeWidget *, GType);
gchar * (*get_display_name) (GladeBaseEditor *, GladeWidget *);
GladeWidget * (*build_child) (GladeBaseEditor *, GladeWidget *, GType);
gboolean (*delete_child) (GladeBaseEditor *, GladeWidget *, GladeWidget *);
gboolean (*move_child) (GladeBaseEditor *, GladeWidget *, GladeWidget *);
};
LIBGLADEUI_API
GType glade_base_editor_get_type (void);
LIBGLADEUI_API
GladeBaseEditor *glade_base_editor_new (GObject *container,
gboolean tree_like,
...);
LIBGLADEUI_API
void glade_base_editor_add_default_properties (GladeBaseEditor *editor,
GladeWidget *gchild);
LIBGLADEUI_API
void glade_base_editor_add_properties (GladeBaseEditor *editor,
GladeWidget *gchild,
...);
LIBGLADEUI_API
void glade_base_editor_add_label (GladeBaseEditor *editor,
gchar *str);
LIBGLADEUI_API
void glade_base_editor_add_popup_items (GladeBaseEditor *editor,
...);
LIBGLADEUI_API
void glade_base_editor_set_show_signal_editor (GladeBaseEditor *editor,
gboolean val);
/* Convenience functions */
LIBGLADEUI_API
GtkWidget *glade_base_editor_pack_new_window (GladeBaseEditor *editor,
gchar *title,
gchar *markup);
G_END_DECLS
#endif /* __GLADE_BASE_EDITOR_H__ */
......@@ -1138,7 +1138,7 @@ glade_command_create (GladeWidgetClass *class,
g_return_val_if_fail (class != NULL, NULL);
g_return_val_if_fail (GLADE_IS_PROJECT (project), NULL);
if (g_type_is_a (class->type, GTK_TYPE_WINDOW) == FALSE)
if (class->toplevel == FALSE)
g_return_val_if_fail (GLADE_IS_WIDGET (parent), NULL);
me = g_object_new (GLADE_COMMAND_CREATE_DELETE_TYPE, NULL);
......
......@@ -185,6 +185,7 @@ glade_editor_property_sensitivity_cb (GladeProperty *property,
void
glade_editor_property_value_changed_cb (GladeProperty *property,
GValue *old_value,
GValue *value,
GladeEditorProperty *eprop)
{
......
This diff is collapsed.
......@@ -4,7 +4,11 @@ VOID:OBJECT
VOID:OBJECT,BOOLEAN
VOID:STRING,STRING,STRING
OBJECT:POINTER
OBJECT:OBJECT,UINT
BOOLEAN:OBJECT
BOOLEAN:BOXED
BOOLEAN:OBJECT,POINTER
BOOLEAN:OBJECT,BOOLEAN
BOOLEAN:OBJECT,UINT
BOOLEAN:OBJECT,OBJECT
STRING:OBJECT
......@@ -1336,7 +1336,7 @@ glade_project_write (GladeProject *project)
* Append toplevel widgets. Each widget then takes
* care of appending its children.
*/
if (g_type_is_a (widget->widget_class->type, GTK_TYPE_WINDOW))
if (widget->parent == NULL && widget->widget_class->toplevel)
{
info = glade_widget_write (widget, interface);
if (!info)
......
......@@ -214,6 +214,7 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value)
GladeProject *project = property->widget ?
glade_widget_get_project (property->widget) : NULL;
gboolean changed = FALSE;
GValue old_value = {0,};
if (!g_value_type_compatible (G_VALUE_TYPE (property->value), G_VALUE_TYPE (value)))
{
......@@ -245,6 +246,10 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value)
glade_property_update_prop_refs (property, property->value, value);
/* Make a copy of the old value */
g_value_init (&old_value, G_VALUE_TYPE (property->value));
g_value_copy (property->value, &old_value);
/* Assign property first so that; if the object need be
* rebuilt, it will reflect the new value
*/
......@@ -257,8 +262,10 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value)
{
g_signal_emit (G_OBJECT (property),
glade_property_signals[VALUE_CHANGED],
0, property->value);
0, &old_value, property->value);
}
g_value_unset (&old_value);
}
static void
......@@ -649,8 +656,8 @@ glade_property_klass_init (GladePropertyKlass *prop_class)
G_STRUCT_OFFSET (GladePropertyKlass,
value_changed),
NULL, NULL,
g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
glade_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
glade_property_signals[TOOLTIP_CHANGED] =
g_signal_new ("tooltip-changed",
......
......@@ -75,7 +75,7 @@ struct _GladePropertyKlass
G_CONST_RETURN gchar * (* get_tooltip) (GladeProperty *);
/* Signals */
void (* value_changed) (GladeProperty *, GValue *);
void (* value_changed) (GladeProperty *, GValue *, GValue *);
void (* tooltip_changed) (GladeProperty *, const gchar *);
};
......
......@@ -683,6 +683,10 @@ glade_widget_class_extend_with_node (GladeWidgetClass *widget_class,
widget_class->fixed =
glade_xml_get_property_boolean (node, GLADE_TAG_FIXED, widget_class->fixed);
/* Check if this class is toplevel */
widget_class->toplevel = glade_xml_get_property_boolean (node,
GLADE_XML_TAG_TOPLEVEL,
FALSE);
/* if we found a <properties> tag on the xml file, we add the properties
* that we read from the xml file to the class.
......@@ -1000,6 +1004,9 @@ glade_widget_class_merge (GladeWidgetClass *widget_class,
if (widget_class->launch_editor == NULL)
widget_class->launch_editor = parent_class->launch_editor;
if (widget_class->toplevel == FALSE)
widget_class->toplevel = parent_class->toplevel;
/* merge the parent's properties */
glade_widget_class_merge_properties
(parent_class->type,
......@@ -1100,6 +1107,7 @@ glade_widget_class_new (GladeXmlNode *class_node,
widget_class->cursor = NULL;
widget_class->large_icon = NULL;
widget_class->small_icon = NULL;
widget_class->toplevel = FALSE;
if (G_TYPE_IS_INSTANTIATABLE (widget_class->type) &&
G_TYPE_IS_ABSTRACT (widget_class->type) == FALSE &&
......
......@@ -208,7 +208,9 @@ struct _GladeWidgetClass
* and the set & get functions of the properties
* of this class.
*/
gboolean toplevel; /* If this class is toplevel */
/* Executed after widget creation: it takes care of creating the
* GladeWidgets associated with internal children. It's also the place
* to set sane defaults, e.g. set the size of a window.
......
......@@ -70,6 +70,7 @@ typedef enum _GladeItemAppearance GladeItemAppearance;
#define GLADE_XML_TAG_PACKING "packing"
#define GLADE_XML_TAG_PLACEHOLDER "placeholder"
#define GLADE_XML_TAG_INTERNAL_CHILD "internal-child"
#define GLADE_XML_TAG_TOPLEVEL "toplevel"
/* Used for catalog tags and attributes */
#define GLADE_TAG_GLADE_CATALOG "glade-catalog"
......
......@@ -125,7 +125,7 @@
</children>
</glade-widget-class>
<glade-widget-class name="GtkWindow" generic-name="window" _title="Window">
<glade-widget-class name="GtkWindow" generic-name="window" _title="Window" toplevel="True">
<post-create-function>glade_gtk_window_post_create</post-create-function>
<properties>
......@@ -309,6 +309,7 @@
<glade-widget-class name="GtkToolbar" generic-name="toolbar" _title="Tool Bar">
<post-create-function>empty</post-create-function>
<launch-editor-function>glade_gtk_toolbar_launch_editor</launch-editor-function>
<properties>
<property id="orientation">
<displayable-values>
......@@ -352,7 +353,7 @@
<post-create-function>glade_gtk_tool_item_post_create</post-create-function>
</glade-widget-class>
<glade-widget-class name="GtkSeparatorToolItem" generic-name="separatortoolbutton" _title="Separator Tool Item"/>
<glade-widget-class name="GtkSeparatorToolItem" generic-name="separatortoolitem" _title="Separator Tool Item"/>
<glade-widget-class name="GtkToolButton" generic-name="toolbutton" _title="Tool Button">
<properties>
......@@ -459,6 +460,7 @@
</glade-widget-class>
<glade-widget-class name="GtkTextView" generic-name="textview" _title="Text View">
<post-create-function>empty</post-create-function>
<properties>
<property id="justification">
<displayable-values>
......@@ -923,9 +925,10 @@
<glade-widget-class name="GtkCalendar" generic-name="calendar" _title="Calendar"/>
<glade-widget-class name="GtkMenu" generic-name="menu" _title="Popup Menu">
<glade-widget-class name="GtkMenu" generic-name="menu" _title="Popup Menu" toplevel="True">
<!-- We do not want glade_gtk_container_post_create be executed -->
<post-create-function>empty</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