fix 3 bad pixels in the shadow of these icons. account for changes on
2004-04-21 Joaquin Cuenca Abela <e98cuenc@yahoo.com> * pixmaps/fontselectiondialog.png, [vh]paned.png, messagedialog.png: fix 3 bad pixels in the shadow of these icons. * src/glade-clipboard-view.c, glade-editor.c, glade-project-view.c, glade-widget-class.h: account for changes on GladeWidget. * src/glade-command.[ch]: account for changes on GladeWidget, and add a new command for add/remove signal handlers. * src/glade-signal.[ch]: rename glade_signal_compare by glade_signal_equal and glade_signal_copy by glade_signal_clone. * src/glade-utils.[ch]: move glade_util_replace_placeholder in a generalized form to glade-widget.c. Make glade_util_get_parent work even for toplevels. New glade_util_object_set_property function to set a property on a GladeWidget using the set_property specified in GladeWidgetClass if any (or g_object_set_property otherwise). * src/glade-widget.[ch]: rewritten from scratch as a GObject. It exposes a new API. It also fixes several bugs. * src/glade-property.[ch]: account for changes on GladeWidget, and assure that we don't assing a widget with an ID higher than needed. * src/glade-signal-editor.[ch]: account for changes on glade-widget.c. The API for adding/changing/removing signals handlers has changed, so this file is quite affected. Chop the biggests functions for clarity. Account for the new command add/remove signal handler (to get TODO/REDO functionality). * src/glade-placeholder.c: fix the destruction of placeholders that don't reach the realized stage. * src/glade-gtk.c: move much of the fill empty functions to post create, querying for properties as size, nb-rows, etc. when needed. Add some placeholders to the action area of a dialog box. * src/glade-clipboard.[ch]: As glade-widget now has a reference count, remove glade_clipboard_add_copy, and use only glade_clipboard_add. * src/glade-popup.c, glade-project-window.c: Account for changes on glade-clipboard.c. * widgets/gtk-base.xml: Add a file for GtkLabel and GtkFrame. * widgets/gtk-box.xml: remove the fill empty function and add a post create function (post create will query the number of items in the box and add the placeholders). * widgets/gtkbutton.xml, gtklabel.xml, gtktogglebutton.xml, gtkcheckbutton.xml, gtkradiobutton.xml: Add a default label. * widgets/gtktable.xml: simplify and remove fill empty (post create will do the work, querying for the number of rows and columns). * widgets/gtkframe.xml: simplify and set a default label.
42
ChangeLog
@ -1,3 +1,45 @@
|
||||
2004-04-21 Joaquin Cuenca Abela <e98cuenc@yahoo.com>
|
||||
|
||||
* pixmaps/fontselectiondialog.png, [vh]paned.png, messagedialog.png:
|
||||
fix 3 bad pixels in the shadow of these icons.
|
||||
* src/glade-clipboard-view.c, glade-editor.c, glade-project-view.c,
|
||||
glade-widget-class.h: account for changes on GladeWidget.
|
||||
* src/glade-command.[ch]: account for changes on GladeWidget, and add
|
||||
a new command for add/remove signal handlers.
|
||||
* src/glade-signal.[ch]: rename glade_signal_compare by glade_signal_equal
|
||||
and glade_signal_copy by glade_signal_clone.
|
||||
* src/glade-utils.[ch]: move glade_util_replace_placeholder in a generalized
|
||||
form to glade-widget.c. Make glade_util_get_parent work even for toplevels.
|
||||
New glade_util_object_set_property function to set a property on a
|
||||
GladeWidget using the set_property specified in GladeWidgetClass if any
|
||||
(or g_object_set_property otherwise).
|
||||
* src/glade-widget.[ch]: rewritten from scratch as a GObject. It exposes a
|
||||
new API. It also fixes several bugs.
|
||||
* src/glade-property.[ch]: account for changes on GladeWidget, and assure
|
||||
that we don't assing a widget with an ID higher than needed.
|
||||
* src/glade-signal-editor.[ch]: account for changes on glade-widget.c. The
|
||||
API for adding/changing/removing signals handlers has changed, so this file
|
||||
is quite affected. Chop the biggests functions for clarity. Account for the
|
||||
new command add/remove signal handler (to get TODO/REDO functionality).
|
||||
* src/glade-placeholder.c: fix the destruction of placeholders that don't
|
||||
reach the realized stage.
|
||||
* src/glade-gtk.c: move much of the fill empty functions to post create,
|
||||
querying for properties as size, nb-rows, etc. when needed. Add some
|
||||
placeholders to the action area of a dialog box.
|
||||
* src/glade-clipboard.[ch]: As glade-widget now has a reference count,
|
||||
remove glade_clipboard_add_copy, and use only glade_clipboard_add.
|
||||
* src/glade-popup.c, glade-project-window.c: Account for changes on
|
||||
glade-clipboard.c.
|
||||
* widgets/gtk-base.xml: Add a file for GtkLabel and GtkFrame.
|
||||
* widgets/gtk-box.xml: remove the fill empty function and add a post create
|
||||
function (post create will query the number of items in the box and add
|
||||
the placeholders).
|
||||
* widgets/gtkbutton.xml, gtklabel.xml, gtktogglebutton.xml,
|
||||
gtkcheckbutton.xml, gtkradiobutton.xml: Add a default label.
|
||||
* widgets/gtktable.xml: simplify and remove fill empty (post create will
|
||||
do the work, querying for the number of rows and columns).
|
||||
* widgets/gtkframe.xml: simplify and set a default label.
|
||||
|
||||
2004-03-12 Joaquin Cuenca Abela <e98cuenc@yahoo.com>
|
||||
|
||||
* src/glade-id-allocater.c: fix a typo.
|
||||
|
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 605 B |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 787 B |
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 726 B |
Before Width: | Height: | Size: 675 B After Width: | Height: | Size: 655 B |
@ -119,12 +119,12 @@ glade_clipboard_view_cell_function (GtkTreeViewColumn *tree_column,
|
||||
|
||||
g_return_if_fail (GLADE_IS_WIDGET (widget));
|
||||
g_return_if_fail (widget->name != NULL);
|
||||
g_return_if_fail (widget->class != NULL);
|
||||
g_return_if_fail (widget->class->icon != NULL);
|
||||
g_return_if_fail (widget->widget_class != NULL);
|
||||
g_return_if_fail (widget->widget_class->icon != NULL);
|
||||
|
||||
if (is_icon)
|
||||
g_object_set (G_OBJECT (cell),
|
||||
"pixbuf", gtk_image_get_pixbuf (GTK_IMAGE (widget->class->icon)),
|
||||
"pixbuf", gtk_image_get_pixbuf (GTK_IMAGE (widget->widget_class->icon)),
|
||||
NULL);
|
||||
else
|
||||
g_object_set (G_OBJECT (cell),
|
||||
|
@ -100,6 +100,7 @@ glade_clipboard_new ()
|
||||
void
|
||||
glade_clipboard_add (GladeClipboard *clipboard, GladeWidget *widget)
|
||||
{
|
||||
g_object_ref (G_OBJECT (widget));
|
||||
/*
|
||||
* Add the GladeWidget to the list of children. And set the
|
||||
* latest addition, to currently selected widget in the clipboard.
|
||||
@ -114,25 +115,6 @@ glade_clipboard_add (GladeClipboard *clipboard, GladeWidget *widget)
|
||||
glade_clipboard_view_add (GLADE_CLIPBOARD_VIEW (clipboard->view), widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_clipboard_add_copy:
|
||||
* @clipboard:
|
||||
* @widget:
|
||||
*
|
||||
* Add a copy of a GladeWidget onto the Clipboard.
|
||||
**/
|
||||
void
|
||||
glade_clipboard_add_copy (GladeClipboard *clipboard, GladeWidget *widget)
|
||||
{
|
||||
GladeWidget *copy;
|
||||
|
||||
g_return_if_fail (GLADE_IS_CLIPBOARD (clipboard));
|
||||
g_return_if_fail (GLADE_IS_WIDGET (widget));
|
||||
|
||||
copy = glade_widget_clone (widget);
|
||||
glade_clipboard_add (clipboard, copy);
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_clipboard_remove:
|
||||
* @clipboard:
|
||||
@ -146,6 +128,7 @@ glade_clipboard_remove (GladeClipboard *clipboard, GladeWidget *widget)
|
||||
GList *list;
|
||||
|
||||
clipboard->widgets = g_list_remove (clipboard->widgets, widget);
|
||||
g_object_unref (G_OBJECT (widget));
|
||||
|
||||
list = g_list_first (clipboard->widgets);
|
||||
if (list != NULL)
|
||||
|
@ -31,9 +31,6 @@ GType glade_clipboard_get_type ();
|
||||
GladeClipboard *glade_clipboard_new ();
|
||||
|
||||
void glade_clipboard_add (GladeClipboard *clipboard, GladeWidget *widget);
|
||||
|
||||
void glade_clipboard_add_copy (GladeClipboard *clipboard, GladeWidget *widget);
|
||||
|
||||
void glade_clipboard_remove (GladeClipboard *clipboard, GladeWidget *widget);
|
||||
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "glade-debug.h"
|
||||
#include "glade-placeholder.h"
|
||||
#include "glade-clipboard.h"
|
||||
#include "glade-signal.h"
|
||||
#include "glade.h"
|
||||
|
||||
|
||||
@ -305,7 +306,7 @@ glade_command_set_property_execute (GladeCommand *cmd)
|
||||
|
||||
g_value_unset (&new_value);
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -436,7 +437,7 @@ glade_command_set_name_execute (GladeCommand *cmd)
|
||||
me->old_name = me->name;
|
||||
me->name = tmp;
|
||||
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -547,18 +548,8 @@ glade_command_create_execute (GladeCommandCreateDelete *me)
|
||||
GladeWidget *widget = me->widget;
|
||||
GladePlaceholder *placeholder = me->placeholder;
|
||||
|
||||
glade_widget_set_contents (widget);
|
||||
|
||||
if (!GTK_WIDGET_TOPLEVEL (widget->widget))
|
||||
{
|
||||
GladeWidget *parent;
|
||||
|
||||
glade_util_replace_placeholder (placeholder, widget);
|
||||
|
||||
/* we can now add the packing properties */
|
||||
parent = glade_widget_get_parent (widget);
|
||||
glade_widget_set_packing_properties (widget, parent);
|
||||
}
|
||||
glade_widget_replace (GTK_WIDGET (placeholder), widget->widget);
|
||||
|
||||
glade_project_add_widget (widget->project, widget->widget);
|
||||
glade_project_selection_set (widget->project, widget->widget, TRUE);
|
||||
@ -578,13 +569,15 @@ glade_command_delete_execute (GladeCommandCreateDelete *me)
|
||||
g_return_val_if_fail (widget != NULL, TRUE);
|
||||
|
||||
parent = glade_widget_get_parent (widget);
|
||||
if (parent) {
|
||||
if (me->placeholder == NULL) {
|
||||
if (parent)
|
||||
{
|
||||
if (me->placeholder == NULL)
|
||||
{
|
||||
me->placeholder = GLADE_PLACEHOLDER (glade_placeholder_new ());
|
||||
g_object_ref (G_OBJECT (me->placeholder));
|
||||
}
|
||||
|
||||
glade_widget_replace_with_placeholder (widget, me->placeholder);
|
||||
glade_widget_replace (widget->widget, GTK_WIDGET (me->placeholder));
|
||||
}
|
||||
|
||||
gtk_widget_hide (widget->widget);
|
||||
@ -668,7 +661,7 @@ glade_command_create_delete_common (GladeWidget *widget,
|
||||
g_debug(("Pushing: %s\n", cmd->description));
|
||||
|
||||
if (glade_command_create_delete_execute (GLADE_COMMAND (me)));
|
||||
glade_command_push_undo(widget->project, GLADE_COMMAND (me));
|
||||
glade_command_push_undo (widget->project, GLADE_COMMAND (me));
|
||||
}
|
||||
|
||||
void
|
||||
@ -704,7 +697,8 @@ glade_command_create (GladeWidgetClass *class,
|
||||
gpw = glade_project_window_get ();
|
||||
g_return_if_fail (GLADE_IS_PALETTE (gpw->palette));
|
||||
|
||||
if (placeholder) {
|
||||
if (placeholder)
|
||||
{
|
||||
parent = glade_util_get_parent (GTK_WIDGET (placeholder));
|
||||
g_return_if_fail (parent != NULL);
|
||||
}
|
||||
@ -712,7 +706,7 @@ glade_command_create (GladeWidgetClass *class,
|
||||
if (!project)
|
||||
project = parent->project;
|
||||
|
||||
widget = glade_widget_new_from_class (class, project);
|
||||
widget = glade_widget_new (class, project);
|
||||
|
||||
/* widget may be null, e.g. the user clicked cancel on a query */
|
||||
if (widget == NULL)
|
||||
@ -756,38 +750,29 @@ glade_command_cut_paste_undo (GladeCommand *cmd)
|
||||
static gboolean
|
||||
glade_command_paste_execute (GladeCommandCutPaste *me)
|
||||
{
|
||||
GladeWidget *widget = me->widget;
|
||||
GladeWidget *glade_widget = me->widget;
|
||||
GladePlaceholder *placeholder = me->placeholder;
|
||||
GladeWidget *parent;
|
||||
GladeProject *project;
|
||||
|
||||
g_return_val_if_fail (g_list_find (me->clipboard->widgets, widget), TRUE);
|
||||
g_return_val_if_fail (g_list_find (me->clipboard->widgets, glade_widget), TRUE);
|
||||
|
||||
parent = glade_util_get_parent (GTK_WIDGET (placeholder));
|
||||
project = parent->project;
|
||||
|
||||
widget->name = glade_widget_new_name (project, widget->class);
|
||||
|
||||
glade_widget_set_contents (widget);
|
||||
glade_widget_connect_signals (widget);
|
||||
|
||||
if (!GTK_WIDGET_TOPLEVEL (widget->widget))
|
||||
if (!GTK_WIDGET_TOPLEVEL (glade_widget->widget))
|
||||
{
|
||||
gtk_widget_ref (GTK_WIDGET (placeholder));
|
||||
|
||||
glade_util_replace_placeholder (placeholder, widget);
|
||||
|
||||
/* we may have changed the parent, regenerate packing properties */
|
||||
glade_widget_set_packing_properties (widget, parent);
|
||||
g_object_ref (G_OBJECT (placeholder));
|
||||
glade_widget_replace (GTK_WIDGET (placeholder), glade_widget->widget);
|
||||
}
|
||||
|
||||
glade_project_add_widget (project, widget->widget);
|
||||
glade_project_selection_set (widget->project, widget->widget, TRUE);
|
||||
glade_project_add_widget (project, glade_widget->widget);
|
||||
glade_project_selection_set (glade_widget->project, glade_widget->widget, TRUE);
|
||||
|
||||
if (GTK_IS_WIDGET (widget->widget))
|
||||
gtk_widget_show_all (GTK_WIDGET (widget->widget));
|
||||
if (GTK_IS_WIDGET (glade_widget->widget))
|
||||
gtk_widget_show_all (GTK_WIDGET (glade_widget->widget));
|
||||
|
||||
glade_clipboard_remove (me->clipboard, widget);
|
||||
glade_clipboard_remove (me->clipboard, glade_widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -795,27 +780,27 @@ glade_command_paste_execute (GladeCommandCutPaste *me)
|
||||
static gboolean
|
||||
glade_command_cut_execute (GladeCommandCutPaste *me)
|
||||
{
|
||||
GladeWidget *widget = me->widget;
|
||||
GladeWidget *parent;
|
||||
GladeWidget *glade_widget = me->widget;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, TRUE);
|
||||
g_return_val_if_fail (glade_widget != NULL, TRUE);
|
||||
|
||||
glade_clipboard_add (me->clipboard, widget);
|
||||
glade_clipboard_add (me->clipboard, glade_widget);
|
||||
|
||||
parent = glade_widget_get_parent (widget);
|
||||
if (parent) {
|
||||
if (me->placeholder == NULL) {
|
||||
if (glade_widget_get_parent (glade_widget))
|
||||
{
|
||||
if (me->placeholder == NULL)
|
||||
{
|
||||
me->placeholder = GLADE_PLACEHOLDER (glade_placeholder_new ());
|
||||
g_object_ref (G_OBJECT (me->placeholder));
|
||||
}
|
||||
|
||||
glade_widget_replace_with_placeholder (widget, me->placeholder);
|
||||
glade_widget_replace (glade_widget->widget, GTK_WIDGET (me->placeholder));
|
||||
}
|
||||
|
||||
gtk_widget_hide (widget->widget);
|
||||
gtk_widget_hide (glade_widget->widget);
|
||||
|
||||
glade_project_selection_remove (widget->project, widget->widget, TRUE);
|
||||
glade_project_remove_widget (widget->project, widget->widget);
|
||||
glade_project_selection_remove (glade_widget->project, glade_widget->widget, TRUE);
|
||||
glade_project_remove_widget (glade_widget->project, glade_widget->widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -893,15 +878,18 @@ glade_command_cut_paste_common (GladeWidget *widget,
|
||||
if (me->placeholder)
|
||||
g_object_ref (G_OBJECT (me->placeholder));
|
||||
|
||||
cmd->description = g_strdup_printf (_("%s %s"), cut ? "Cut" : "Paste", widget->name);
|
||||
if (cut)
|
||||
cmd->description = g_strdup_printf (_("Cut %s"), widget->name);
|
||||
else
|
||||
cmd->description = g_strdup_printf (_("Paste %s"), widget->name);
|
||||
|
||||
g_debug(("Pushing: %s\n", cmd->description));
|
||||
|
||||
/*
|
||||
* Push it onto the undo stack only on success
|
||||
*/
|
||||
if (glade_command_cut_paste_execute (GLADE_COMMAND (me)))
|
||||
glade_command_push_undo (project, GLADE_COMMAND (me));
|
||||
if (glade_command_cut_paste_execute (cmd))
|
||||
glade_command_push_undo (project, cmd);
|
||||
}
|
||||
|
||||
void
|
||||
@ -921,12 +909,10 @@ glade_command_paste (GladePlaceholder *placeholder)
|
||||
g_return_if_fail (GLADE_IS_PLACEHOLDER (placeholder));
|
||||
|
||||
widget = gpw->clipboard->curr;
|
||||
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
parent = glade_util_get_parent (GTK_WIDGET (placeholder));
|
||||
|
||||
glade_command_cut_paste_common (widget, placeholder, parent->project, FALSE);
|
||||
}
|
||||
|
||||
@ -951,3 +937,101 @@ glade_command_cut (GladeWidget *widget)
|
||||
glade_command_cut_paste_common (widget, NULL, widget->project, TRUE);
|
||||
}
|
||||
|
||||
/*********************************************************/
|
||||
/******* GLADE_COMMAND_ADD_SIGNAL *******/
|
||||
/*********************************************************/
|
||||
|
||||
/* create a new GladeCommandAddRemoveSignal class. Objects of this class will
|
||||
* encapsulate an "add or remove signal handler" operation */
|
||||
typedef struct {
|
||||
GladeCommand parent;
|
||||
|
||||
gboolean add;
|
||||
GladeSignal *signal;
|
||||
GtkWidget *widget;
|
||||
} GladeCommandAddSignal;
|
||||
|
||||
/* standard macros */
|
||||
GLADE_MAKE_COMMAND (GladeCommandAddSignal, glade_command_add_signal);
|
||||
#define GLADE_COMMAND_ADD_SIGNAL_TYPE (glade_command_add_signal_get_type ())
|
||||
#define GLADE_COMMAND_ADD_SIGNAL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GLADE_COMMAND_ADD_SIGNAL_TYPE, GladeCommandAddSignal))
|
||||
#define GLADE_COMMAND_ADD_SIGNAL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GLADE_COMMAND_ADD_SIGNAL_TYPE, GladeCommandAddSignalClass))
|
||||
#define GLADE_IS_COMMAND_ADD_SIGNAL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GLADE_COMMAND_ADD_SIGNAL_TYPE))
|
||||
#define GLADE_IS_COMMAND_ADD_SIGNAL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GLADE_COMMAND_ADD_SIGNAL_TYPE))
|
||||
|
||||
static void
|
||||
glade_command_add_signal_finalize (GObject *obj)
|
||||
{
|
||||
GladeCommandAddSignal *cmd = GLADE_COMMAND_ADD_SIGNAL (obj);
|
||||
glade_signal_free (cmd->signal);
|
||||
g_object_unref (cmd->widget);
|
||||
glade_command_finalize (obj);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_command_add_signal_undo (GladeCommand *this)
|
||||
{
|
||||
return glade_command_add_signal_execute (this);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_command_add_signal_execute (GladeCommand *this)
|
||||
{
|
||||
GladeCommandAddSignal *cmd = GLADE_COMMAND_ADD_SIGNAL (this);
|
||||
|
||||
if (cmd->add)
|
||||
glade_widget_add_signal_handler (glade_widget_get_from_gtk_widget (cmd->widget), cmd->signal);
|
||||
else
|
||||
glade_widget_remove_signal_handler (glade_widget_get_from_gtk_widget (cmd->widget), cmd->signal);
|
||||
|
||||
cmd->add = !cmd->add;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
glade_command_add_signal_unifies (GladeCommand *this, GladeCommand *other)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
glade_command_add_signal_collapse (GladeCommand *this, GladeCommand *other)
|
||||
{
|
||||
g_return_if_reached ();
|
||||
}
|
||||
|
||||
static void
|
||||
glade_command_add_remove_signal(GladeWidget *glade_widget, const GladeSignal *signal, gboolean add)
|
||||
{
|
||||
GladeCommandAddSignal *me = GLADE_COMMAND_ADD_SIGNAL (g_object_new (GLADE_COMMAND_ADD_SIGNAL_TYPE, NULL));
|
||||
GladeCommand *cmd = GLADE_COMMAND (me);
|
||||
GtkWidget *widget = glade_widget_get_widget (glade_widget);
|
||||
|
||||
/* we can only add/remove a signal to a widget that has been wrapped by a GladeWidget */
|
||||
g_assert (glade_widget != NULL);
|
||||
g_assert (glade_widget->project != NULL);
|
||||
|
||||
g_object_ref (widget);
|
||||
me->widget = widget;
|
||||
me->add = add;
|
||||
me->signal = glade_signal_clone (signal);
|
||||
if (add)
|
||||
cmd->description = g_strdup_printf (_("Add signal handler %s"), signal->handler);
|
||||
else
|
||||
cmd->description = g_strdup_printf (_("Remove signal handler %s"), signal->handler);
|
||||
|
||||
if (glade_command_add_signal_execute (cmd))
|
||||
glade_command_push_undo (glade_widget->project, cmd);
|
||||
}
|
||||
|
||||
void
|
||||
glade_command_add_signal(GladeWidget *glade_widget, const GladeSignal *signal)
|
||||
{
|
||||
glade_command_add_remove_signal (glade_widget, signal, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
glade_command_remove_signal(GladeWidget *glade_widget, const GladeSignal *signal)
|
||||
{
|
||||
glade_command_add_remove_signal (glade_widget, signal, FALSE);
|
||||
}
|
||||
|
@ -41,17 +41,20 @@ struct _GladeCommandClass
|
||||
|
||||
GType glade_command_get_type (void);
|
||||
|
||||
void glade_command_undo (GladeProject *project);
|
||||
void glade_command_redo (GladeProject *project);
|
||||
void glade_command_undo (GladeProject *project);
|
||||
void glade_command_redo (GladeProject *project);
|
||||
|
||||
void glade_command_set_property (GladeProperty *property, const GValue *value);
|
||||
void glade_command_set_name (GladeWidget *obj, const gchar *name);
|
||||
void glade_command_set_property (GladeProperty *property, const GValue *value);
|
||||
void glade_command_set_name (GladeWidget *glade_widget, const gchar *name);
|
||||
|
||||
void glade_command_delete (GladeWidget *widget);
|
||||
void glade_command_create (GladeWidgetClass *class, GladePlaceholder *placeholder, GladeProject *project);
|
||||
void glade_command_delete (GladeWidget *glade_widget);
|
||||
void glade_command_create (GladeWidgetClass *widget_class, GladePlaceholder *placeholder, GladeProject *project);
|
||||
|
||||
void glade_command_cut (GladeWidget *widget);
|
||||
void glade_command_paste (GladePlaceholder *placeholder);
|
||||
void glade_command_cut (GladeWidget *glade_widget);
|
||||
void glade_command_paste (GladePlaceholder *placeholder);
|
||||
|
||||
void glade_command_add_signal (GladeWidget *glade_widget, const GladeSignal *signal);
|
||||
void glade_command_remove_signal (GladeWidget *glade_widget, const GladeSignal *signal);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -1307,7 +1307,7 @@ glade_editor_property_load (GladeEditorProperty *property, GladeWidget *widget)
|
||||
return;
|
||||
}
|
||||
|
||||
property->property = glade_widget_get_property_by_class (widget, class);
|
||||
property->property = glade_widget_get_property (widget, class->id);
|
||||
|
||||
g_return_if_fail (property->property != NULL);
|
||||
g_return_if_fail (property->property->class == property->class);
|
||||
@ -1403,10 +1403,10 @@ glade_editor_load_packing_page (GladeEditor *editor, GladeWidget *widget)
|
||||
|
||||
for (ancestor = parent; ancestor != NULL; ancestor = glade_widget_get_parent (ancestor))
|
||||
{
|
||||
for (list = ancestor->class->child_properties; list; list = list->next)
|
||||
for (list = ancestor->widget_class->child_properties; list; list = list->next)
|
||||
{
|
||||
property_class = list->data;
|
||||
if (!ancestor->class->child_property_applies (ancestor->widget, widget->widget, property_class->id))
|
||||
if (!ancestor->widget_class->child_property_applies (ancestor->widget, widget->widget, property_class->id))
|
||||
continue;
|
||||
|
||||
g_assert (property_class->packing == TRUE);
|
||||
@ -1445,7 +1445,7 @@ glade_editor_load_widget (GladeEditor *editor, GladeWidget *widget)
|
||||
return;
|
||||
|
||||
/* Load the GladeWidgetClass */
|
||||
class = widget ? widget->class : NULL;
|
||||
class = widget ? widget->widget_class : NULL;
|
||||
if (editor->loaded_class != class)
|
||||
glade_editor_load_widget_class (editor, class);
|
||||
|
||||
|
180
src/glade-gtk.c
@ -26,6 +26,31 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "glade-plugin.h"
|
||||
|
||||
/* Borrow from libgnome/libgnome.h */
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# ifdef GNOME_EXPLICIT_TRANSLATION_DOMAIN
|
||||
# undef _
|
||||
# define _(String) dgettext (GNOME_EXPLICIT_TRANSLATION_DOMAIN, String)
|
||||
# else
|
||||
# define _(String) gettext (String)
|
||||
# endif
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
#else
|
||||
/* Stubs that do something close enough. */
|
||||
# define textdomain(String) (String)
|
||||
# define gettext(String) (String)
|
||||
# define dgettext(Domain,Message) (Message)
|
||||
# define dcgettext(Domain,Message,Type) (Message)
|
||||
# define bindtextdomain(Domain,Directory) (Domain)
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#define GLADEGTK_API __declspec(dllexport)
|
||||
#else
|
||||
@ -172,18 +197,24 @@ glade_gtk_box_set_size (GObject *object, GValue *value)
|
||||
if (new_size == old_size)
|
||||
return;
|
||||
|
||||
if (new_size > old_size) {
|
||||
if (new_size > old_size)
|
||||
{
|
||||
/* The box has grown. Add placeholders */
|
||||
while (new_size > old_size) {
|
||||
while (new_size > old_size)
|
||||
{
|
||||
GladePlaceholder *placeholder = GLADE_PLACEHOLDER (glade_placeholder_new ());
|
||||
gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (placeholder));
|
||||
old_size++;
|
||||
}
|
||||
} else {/* new_size < old_size */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* new_size < old_size */
|
||||
/* The box has shrunk. Remove the widgets that are on those slots */
|
||||
GList *child = g_list_last (box->children);
|
||||
|
||||
while (child && old_size > new_size) {
|
||||
while (child && old_size > new_size)
|
||||
{
|
||||
GtkWidget *child_widget = ((GtkBoxChild *) (child->data))->widget;
|
||||
GladeWidget *glade_widget;
|
||||
|
||||
@ -460,21 +491,23 @@ glade_gtk_button_set_stock (GObject *object, GValue *value)
|
||||
glade_widget = glade_widget_get_from_gtk_widget (button);
|
||||
g_return_if_fail (glade_widget != NULL);
|
||||
|
||||
property = glade_widget_get_property_by_id (glade_widget, "stock", FALSE);
|
||||
text = glade_widget_get_property_by_id (glade_widget, "label", FALSE);
|
||||
property = glade_widget_get_property (glade_widget, "stock");
|
||||
text = glade_widget_get_property (glade_widget, "label");
|
||||
g_return_if_fail (property != NULL);
|
||||
g_return_if_fail (text != NULL);
|
||||
|
||||
list = property->class->choices;
|
||||
for (; list; list = list->next) {
|
||||
for (; list; list = list->next)
|
||||
{
|
||||
choice = list->data;
|
||||
if (val == choice->value)
|
||||
break;
|
||||
}
|
||||
g_return_if_fail (list != NULL);
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (button),
|
||||
GTK_BIN (button)->child);
|
||||
if (GTK_BIN (button)->child)
|
||||
gtk_container_remove (GTK_CONTAINER (button),
|
||||
GTK_BIN (button)->child);
|
||||
|
||||
if (!gtk_stock_lookup (choice->id, &item))
|
||||
{
|
||||
@ -483,7 +516,9 @@ glade_gtk_button_set_stock (GObject *object, GValue *value)
|
||||
label = gtk_label_new (g_value_get_string (text->value));
|
||||
gtk_container_add (GTK_CONTAINER (button), label);
|
||||
gtk_widget_show_all (button);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *image;
|
||||
GtkWidget *hbox;
|
||||
@ -542,6 +577,117 @@ ignore (GObject *object, GValue *value)
|
||||
|
||||
|
||||
/* ------------------------------------ Post Create functions ------------------------------ */
|
||||
static int
|
||||
ask_for_number (const char *title, const char *name, int min, int max, int def)
|
||||
{
|
||||
int number;
|
||||
GtkWidget *dialog = gtk_dialog_new_with_buttons (title, NULL,
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
||||
GtkWidget *label = gtk_label_new (name);
|
||||
GtkWidget *spin_button = gtk_spin_button_new_with_range ((double) min, (double) max, 1.0);
|
||||
GtkWidget *hbox = gtk_hbox_new (FALSE, 4);
|
||||
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spin_button), 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_button), FALSE);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button), (double) def);
|
||||
|
||||
gtk_box_pack_end (GTK_BOX (hbox), spin_button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 4);
|
||||
|
||||
gtk_widget_show_all (hbox);
|
||||
/* even if the user destroys the dialog box, we retrieve the number and we accept it. I.e., this function never fails */
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
number = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin_button));
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
return number;
|
||||
}
|
||||
|
||||
void GLADEGTK_API
|
||||
glade_gtk_box_post_create (GObject *object)
|
||||
{
|
||||
GladeProperty *property = glade_widget_get_property (glade_widget_get_from_gtk_widget (object), "size");
|
||||
GValue value = {0,};
|
||||
|
||||
g_value_init (&value, G_TYPE_INT);
|
||||
g_value_set_int (&value, ask_for_number(_("Create a box"), _("Number of items:"), 0, 10000, 3));
|
||||
|
||||
glade_property_set (property, &value);
|
||||
}
|
||||
|
||||
void GLADEGTK_API
|
||||
glade_gtk_notebook_post_create (GObject *object)
|
||||
{
|
||||
GladeProperty *property = glade_widget_get_property (glade_widget_get_from_gtk_widget (object), "size");
|
||||
GValue value = {0,};
|
||||
|
||||
g_value_init (&value, G_TYPE_INT);
|
||||
g_value_set_int (&value, ask_for_number(_("Create a notebook"), _("Number of pages:"), 0, 100, 3));
|
||||
}
|
||||
|
||||
void GLADEGTK_API
|
||||
glade_gtk_table_post_create (GObject *object)
|
||||
{
|
||||
GladeWidget *widget = glade_widget_get_from_gtk_widget (object);
|
||||
GladeProperty *property_rows = glade_widget_get_property (widget, "n-rows");
|
||||
GladeProperty *property_cols = glade_widget_get_property (widget, "n-columns");
|
||||
GValue gvrows = {0,};
|
||||
GValue gvcols = {0,};
|
||||
GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Create a table"), NULL,
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
|
||||
GtkWidget *label_rows = gtk_label_new (_("Number of rows:"));
|
||||
GtkWidget *label_cols = gtk_label_new (_("Number of columns:"));
|
||||
GtkWidget *spin_button_rows = gtk_spin_button_new_with_range (0.0, 10000.0, 1.0);
|
||||
GtkWidget *spin_button_cols = gtk_spin_button_new_with_range (0.0, 10000.0, 1.0);
|
||||
GtkWidget *table = gtk_table_new (2, 2, TRUE);
|
||||
|
||||
g_value_init (&gvrows, G_TYPE_INT);
|
||||
g_value_init (&gvcols, G_TYPE_INT);
|
||||
|
||||
gtk_misc_set_alignment (GTK_MISC (label_rows), 0.0, 0.5);
|
||||
gtk_misc_set_alignment (GTK_MISC (label_cols), 0.0, 0.5);
|
||||
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spin_button_rows), 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_button_rows), FALSE);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button_rows), 3.0);
|
||||
|
||||
gtk_spin_button_set_digits (GTK_SPIN_BUTTON (spin_button_cols), 0);
|
||||
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_button_cols), FALSE);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_button_cols), 3.0);
|
||||
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label_rows, 0, 1, 0, 1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), spin_button_rows, 1, 2, 0, 1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label_cols, 0, 1, 1, 2);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), spin_button_cols, 1, 2, 1, 2);
|
||||
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 12);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show_all (table);
|
||||
/* even if the user destroys the dialog box, we retrieve the number and we accept it. I.e., this function never fails */
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
g_value_set_int (&gvrows, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin_button_rows)));
|
||||
g_value_set_int (&gvcols, gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin_button_cols)));
|
||||
|
||||
glade_property_set (property_rows, &gvrows);
|
||||
glade_property_set (property_cols, &gvcols);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
void GLADEGTK_API
|
||||
glade_gtk_window_post_create (GObject *object)
|
||||
{
|
||||
@ -567,13 +713,12 @@ glade_gtk_dialog_post_create (GObject *object)
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
/* create the GladeWidgets for internal childrens */
|
||||
/* create the GladeWidgets for internal children */
|
||||
child_class = glade_widget_class_get_by_name ("GtkVBox");
|
||||
if (!child_class)
|
||||
return;
|
||||
|
||||
vbox_widget = glade_widget_new_for_internal_child (child_class, widget,
|
||||
dialog->vbox, "vbox");
|
||||
vbox_widget = glade_widget_new_for_internal_child (child_class, widget, dialog->vbox, "vbox");
|
||||
if (!vbox_widget)
|
||||
return;
|
||||
|
||||
@ -581,8 +726,9 @@ glade_gtk_dialog_post_create (GObject *object)
|
||||
if (!child_class)
|
||||
return;
|
||||
|
||||
actionarea_widget = glade_widget_new_for_internal_child (child_class, vbox_widget,
|
||||
dialog->action_area, "action_area");
|
||||
gtk_box_pack_start (GTK_BOX (dialog->action_area), GTK_WIDGET (glade_placeholder_new ()), TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (dialog->action_area), GTK_WIDGET (glade_placeholder_new ()), TRUE, TRUE, 0);
|
||||
actionarea_widget = glade_widget_new_for_internal_child (child_class, vbox_widget, dialog->action_area, "action_area");
|
||||
if (!actionarea_widget)
|
||||
return;
|
||||
|
||||
@ -600,6 +746,7 @@ glade_gtk_message_dialog_post_create (GObject *object)
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 115);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void GLADEGTK_API
|
||||
glade_gtk_table_post_create (GObject *object)
|
||||
{
|
||||
@ -612,7 +759,7 @@ glade_gtk_table_post_create (GObject *object)
|
||||
/* When we create a table and we are loading from disk a glade
|
||||
* file, we need to add a placeholder because the size can't be
|
||||
* 0 so gtk+ adds a widget that we don't want there.
|
||||
* GtkBox is does not have this problem because
|
||||
* GtkBox does not have this problem because
|
||||
* a size of 0x0 is the default one. Check if the size is 0
|
||||
* and that we don't have a children.
|
||||
*/
|
||||
@ -621,6 +768,7 @@ glade_gtk_table_post_create (GObject *object)
|
||||
glade_placeholder_new ());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* --------------------------------- Replace child functions ------------------------------- */
|
||||
void GLADEGTK_API
|
||||
|
86
src/glade-marshallers.c
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
|
||||
#define g_marshal_value_peek_char(v) g_value_get_char (v)
|
||||
#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
|
||||
#define g_marshal_value_peek_int(v) g_value_get_int (v)
|
||||
#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
|
||||
#define g_marshal_value_peek_long(v) g_value_get_long (v)
|
||||
#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
|
||||
#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
|
||||
#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
|
||||
#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
|
||||
#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
|
||||
#define g_marshal_value_peek_float(v) g_value_get_float (v)
|
||||
#define g_marshal_value_peek_double(v) g_value_get_double (v)
|
||||
#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
|
||||
#define g_marshal_value_peek_param(v) g_value_get_param (v)
|
||||
#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
|
||||
#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
|
||||
#define g_marshal_value_peek_object(v) g_value_get_object (v)
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
|
||||
* Do not access GValues directly in your code. Instead, use the
|
||||
* g_value_get_*() functions
|
||||
*/
|
||||
#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
|
||||
#define g_marshal_value_peek_char(v) (v)->data[0].v_int
|
||||
#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
|
||||
#define g_marshal_value_peek_int(v) (v)->data[0].v_int
|
||||
#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
|
||||
#define g_marshal_value_peek_long(v) (v)->data[0].v_long
|
||||
#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
|
||||
#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
|
||||
#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
|
||||
#define g_marshal_value_peek_enum(v) (v)->data[0].v_int
|
||||
#define g_marshal_value_peek_flags(v) (v)->data[0].v_uint
|
||||
#define g_marshal_value_peek_float(v) (v)->data[0].v_float
|
||||
#define g_marshal_value_peek_double(v) (v)->data[0].v_double
|
||||
#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
|
||||
#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
|
||||
#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
|
||||
#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
|
||||
#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
|
||||
#endif /* !G_ENABLE_DEBUG */
|
||||
|
||||
|
||||
/* VOID:POINTER,POINTER (toto.txt:1) */
|
||||
void
|
||||
glade_cclosure_marshal_VOID__POINTER_POINTER (GClosure *closure,
|
||||
GValue *return_value,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer invocation_hint,
|
||||
gpointer marshal_data)
|
||||
{
|
||||
typedef void (*GMarshalFunc_VOID__POINTER_POINTER) (gpointer data1,
|
||||
gpointer arg_1,
|
||||
gpointer arg_2,
|
||||
gpointer data2);
|
||||
register GMarshalFunc_VOID__POINTER_POINTER callback;
|
||||
register GCClosure *cc = (GCClosure*) closure;
|
||||
register gpointer data1, data2;
|
||||
|
||||
g_return_if_fail (n_param_values == 3);
|
||||
|
||||
if (G_CCLOSURE_SWAP_DATA (closure))
|
||||
{
|
||||
data1 = closure->data;
|
||||
data2 = g_value_peek_pointer (param_values + 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
data1 = g_value_peek_pointer (param_values + 0);
|
||||
data2 = closure->data;
|
||||
}
|
||||
callback = (GMarshalFunc_VOID__POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
|
||||
|
||||
callback (data1,
|
||||
g_marshal_value_peek_pointer (param_values + 1),
|
||||
g_marshal_value_peek_pointer (param_values + 2),
|
||||
data2);
|
||||
}
|
||||
|
20
src/glade-marshallers.h
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
#ifndef __glade_cclosure_marshal_MARSHAL_H__
|
||||
#define __glade_cclosure_marshal_MARSHAL_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* VOID:POINTER,POINTER (toto.txt:1) */
|
||||
extern void glade_cclosure_marshal_VOID__POINTER_POINTER (GClosure *closure,
|
||||
GValue *return_value,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer invocation_hint,
|
||||
gpointer marshal_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __glade_cclosure_marshal_MARSHAL_H__ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
|
||||
/*
|
||||
* Copyright (C) 2003 Joaquin Cuenca Abela
|
||||
* Copyright (C) 2003, 2004 Joaquin Cuenca Abela
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
@ -134,7 +134,10 @@ glade_placeholder_finalize (GObject *object)
|
||||
|
||||
g_return_if_fail (GLADE_IS_PLACEHOLDER (object));
|
||||
placeholder = GLADE_PLACEHOLDER (object);
|
||||
g_object_unref (placeholder->placeholder_pixmap);
|
||||
|
||||
/* placeholder->placeholder_pixmap can be NULL if the placeholder is destroyed before it's realized */
|
||||
if (placeholder->placeholder_pixmap)
|
||||
g_object_unref (placeholder->placeholder_pixmap);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ glade_popup_copy_cb (GtkMenuItem *item, GladeWidget *widget)
|
||||
GladeProjectWindow *gpw;
|
||||
|
||||
gpw = glade_project_window_get ();
|
||||
glade_clipboard_add_copy (gpw->clipboard, widget);
|
||||
glade_clipboard_add (gpw->clipboard, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -415,18 +415,18 @@ glade_project_view_cell_function (GtkTreeViewColumn *tree_column,
|
||||
return;
|
||||
|
||||
g_return_if_fail (widget->name != NULL);
|
||||
g_return_if_fail (widget->class != NULL);
|
||||
g_return_if_fail (GPOINTER_TO_INT (widget->class) > 5000);
|
||||
g_return_if_fail (widget->class->name != NULL);
|
||||
g_return_if_fail (widget->class->icon != NULL);
|
||||
g_return_if_fail (widget->widget_class != NULL);
|
||||
g_return_if_fail (GPOINTER_TO_INT (widget->widget_class) > 5000);
|
||||
g_return_if_fail (widget->widget_class->name != NULL);
|
||||
g_return_if_fail (widget->widget_class->icon != NULL);
|
||||
|
||||
if (is_icon)
|
||||
{
|
||||
if (gtk_image_get_storage_type GTK_IMAGE (widget->class->icon) != GTK_IMAGE_PIXBUF)
|
||||
if (gtk_image_get_storage_type GTK_IMAGE (widget->widget_class->icon) != GTK_IMAGE_PIXBUF)
|
||||
return;
|
||||
|
||||
g_object_set (G_OBJECT (cell), "pixbuf",
|
||||
gtk_image_get_pixbuf (GTK_IMAGE (widget->class->icon)), NULL);
|
||||
gtk_image_get_pixbuf (GTK_IMAGE (widget->widget_class->icon)), NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -412,7 +412,7 @@ gpw_copy_cb (void)
|
||||
GladeWidget *widget = glade_widget_get_from_gtk_widget (GTK_WIDGET (list->data));
|
||||
|
||||
if (widget)
|
||||
glade_clipboard_add_copy (gpw->clipboard, widget);
|
||||
glade_clipboard_add (gpw->clipboard, widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,7 @@ glade_project_init (GladeProject *project)
|
||||
project->undo_stack = NULL;
|
||||
project->prev_redo_item = NULL;
|
||||
project->widget_names_allocator = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) glade_id_allocator_free);
|
||||
project->widget_old_names = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) g_free);
|
||||
}
|
||||
|
||||
GladeProject *
|
||||
@ -206,7 +207,8 @@ glade_project_finalize (GObject *object)
|
||||
g_free (project->path);
|
||||
|
||||
g_hash_table_destroy (project->widget_names_allocator);
|
||||
|
||||
g_hash_table_destroy (project->widget_old_names);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@ -218,6 +220,28 @@ glade_project_selection_changed (GladeProject *project)
|
||||
0);
|
||||
}
|
||||
|
||||
static void
|
||||
glade_project_on_widget_notify (GladeWidget *widget, GParamSpec *arg, GladeProject *project)
|
||||
{
|
||||
g_return_if_fail (GLADE_IS_WIDGET (widget));
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
|
||||
switch (arg->name[0])
|
||||
{
|
||||
case 'n':
|
||||
if (strcmp (arg->name, "name") == 0)
|
||||
{
|
||||
const char *old_name = g_hash_table_lookup (project->widget_old_names, widget);
|
||||
glade_project_widget_name_changed (project, widget, old_name);
|
||||
g_hash_table_insert (project->widget_old_names, widget, g_strdup (glade_widget_get_name (widget)));
|
||||
}
|
||||
|
||||
case 'p':
|
||||
if (strcmp (arg->name, "project") == 0)
|
||||
glade_project_remove_widget (project, glade_widget_get_widget (widget));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* glade_project_add_widget:
|
||||
* @project: the project the widget is added to
|
||||
@ -238,12 +262,14 @@ glade_project_add_widget (GladeProject *project, GtkWidget *widget)
|
||||
return;
|
||||
|
||||
/* If it's a container add the children as well */
|
||||
if (GTK_IS_CONTAINER (widget)) {
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
{
|
||||
GList *list;
|
||||
GtkWidget *child;
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (widget));
|
||||
for (; list; list = list->next) {
|
||||
for (; list; list = list->next)
|
||||
{
|
||||
child = list->data;
|
||||
glade_project_add_widget (project, child);
|
||||
}
|
||||
@ -254,7 +280,7 @@ glade_project_add_widget (GladeProject *project, GtkWidget *widget)
|
||||
/* The internal widgets (e.g. the label of a GtkButton) are handled
|
||||
* by gtk and don't have an associated GladeWidget: we don't want to
|
||||
* add these to our list. It would be nicer to have a flag to check
|
||||
* (as we do for placeholdres) instead of checking for the associated
|
||||
* (as we do for placeholders) instead of checking for the associated
|
||||
* GladeWidget, so that we can assert that if a widget is _not_ internal,
|
||||
* it _must_ have a corresponding GladeWidget... Anyway this suffice
|
||||
* for now.
|
||||
@ -262,7 +288,10 @@ glade_project_add_widget (GladeProject *project, GtkWidget *widget)
|
||||
if (!gwidget)
|
||||
return;
|
||||
|
||||
gwidget->project = project;
|
||||
glade_widget_set_project (gwidget, project);
|
||||
g_hash_table_insert (project->widget_old_names, gwidget, g_strdup (glade_widget_get_name (gwidget)));
|
||||
|
||||
g_signal_connect (G_OBJECT (gwidget), "notify", (GCallback) glade_project_on_widget_notify, project);
|
||||
|
||||
project->widgets = g_list_prepend (project->widgets, widget);
|
||||
g_object_ref (widget);
|
||||
@ -274,7 +303,7 @@ glade_project_add_widget (GladeProject *project, GtkWidget *widget)
|
||||
}
|
||||
|
||||
void
|
||||
glade_project_release_widget_name (GladeProject *project, const char *widget_name)
|
||||
glade_project_release_widget_name (GladeProject *project, GladeWidget *glade_widget, const char *widget_name)
|
||||
{
|
||||
const char *first_number = widget_name;
|
||||
char *end_number;
|
||||
@ -311,6 +340,7 @@ glade_project_release_widget_name (GladeProject *project, const char *widget_nam
|
||||
glade_id_allocator_release (id_allocator, id);
|
||||
|
||||
lblend:
|
||||
g_hash_table_remove (project->widget_old_names, glade_widget);
|
||||
g_free (base_widget_name);
|
||||
}
|
||||
|
||||
@ -322,7 +352,7 @@ glade_project_release_widget_name (GladeProject *project, const char *widget_nam
|
||||
* Remove a widget from the project.
|
||||
* Note that when removing the GtkWidget from the project we
|
||||
* don't change ->project in the associated GladeWidget, this
|
||||
* way UNDO works.
|
||||
* way UNDO can work.
|
||||
*/
|
||||
void
|
||||
glade_project_remove_widget (GladeProject *project, GtkWidget *widget)
|
||||
@ -337,12 +367,14 @@ glade_project_remove_widget (GladeProject *project, GtkWidget *widget)
|
||||
return;
|
||||
|
||||
/* If it's a container remove the children as well */
|
||||
if (GTK_IS_CONTAINER (widget)) {
|
||||
if (GTK_IS_CONTAINER (widget))
|
||||
{
|
||||
GList *list;
|
||||
GtkWidget *child;
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (widget));
|
||||
for (; list; list = list->next) {
|
||||
for (; list; list = list->next)
|
||||
{
|
||||
child = list->data;
|
||||
glade_project_remove_widget (project, child);
|
||||
}
|
||||
@ -359,7 +391,7 @@ glade_project_remove_widget (GladeProject *project, GtkWidget *widget)
|
||||
if (widget_l != NULL)
|
||||
{
|
||||
g_object_unref (widget);
|
||||
glade_project_release_widget_name (project, gwidget->name);
|
||||
glade_project_release_widget_name (project, gwidget, glade_widget_get_name (gwidget));
|
||||
project->widgets = g_list_delete_link (project->widgets, widget_l);
|
||||
}
|
||||
|
||||
@ -376,7 +408,7 @@ glade_project_widget_name_changed (GladeProject *project, GladeWidget *widget, c
|
||||
g_return_if_fail (GLADE_IS_PROJECT (project));
|
||||
g_return_if_fail (GLADE_IS_WIDGET (widget));
|
||||
|
||||
glade_project_release_widget_name (project, old_name);
|
||||
glade_project_release_widget_name (project, widget, old_name);
|
||||
|
||||
g_signal_emit (G_OBJECT (project),
|
||||
glade_project_signals [WIDGET_NAME_CHANGED],
|
||||
@ -433,7 +465,8 @@ glade_project_new_widget_name (GladeProject *project, const char *base_name)
|
||||
GladeIDAllocator *id_allocator;
|
||||
guint i = 1;
|
||||
|
||||
while (TRUE) {
|
||||
while (TRUE)
|
||||
{
|
||||
id_allocator = g_hash_table_lookup (project->widget_names_allocator, base_name);
|
||||
|
||||
if (id_allocator == NULL)
|
||||
@ -575,7 +608,7 @@ glade_project_write (GladeXmlContext *context, const GladeProject *project)
|
||||
* care of appending its children.
|
||||
*/
|
||||
if (GLADE_WIDGET_IS_TOPLEVEL (widget)) {
|
||||
child = glade_widget_write (context, widget);
|
||||
child = glade_widget_write (widget, context);
|
||||
if (!child)
|
||||
return NULL;
|
||||
|
||||
@ -612,7 +645,7 @@ glade_project_new_from_node (GladeXmlNode *node)
|
||||
for (; child; child = glade_xml_node_next (child)) {
|
||||
if (!glade_xml_node_verify_silent (child, GLADE_XML_TAG_WIDGET))
|
||||
continue;
|
||||
widget = glade_widget_new_from_node (child, project);
|
||||
widget = glade_widget_read (project, child);
|
||||
if (!widget) {
|
||||
g_warning ("Failed to read a <wideget> tag");
|
||||
continue;
|
||||
|
@ -47,6 +47,7 @@ struct _GladeProject
|
||||
GList *undo_stack; /* A stack with the last executed commands */
|
||||
GList *prev_redo_item; /* Points to the item previous to the redo items */
|
||||
GHashTable *widget_names_allocator; /* hash table with the used widget names */
|
||||
GHashTable *widget_old_names; /* widget -> old name of the widget */
|
||||
};
|
||||
|
||||
struct _GladeProjectClass
|
||||
|
@ -124,13 +124,13 @@ glade_property_set_property (GladeProperty *property, const GValue *value)
|
||||
if (property->class->packing)
|
||||
{
|
||||
GladeWidget *parent = glade_widget_get_parent (property->widget);
|
||||
GtkContainer *container = GTK_CONTAINER (parent->widget);
|
||||
GtkWidget *child = property->widget->widget;
|
||||
GtkContainer *container = GTK_CONTAINER (glade_widget_get_widget (parent));
|
||||
GtkWidget *child = glade_widget_get_widget (property->widget);
|
||||
gtk_container_child_set_property (container, child, property->class->id, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
GObject *gobject = G_OBJECT (property->widget->widget);
|
||||
GObject *gobject = G_OBJECT (glade_widget_get_widget (property->widget));
|
||||
g_object_set_property (gobject, property->class->id, value);
|
||||
}
|
||||
}
|
||||
@ -158,14 +158,9 @@ glade_property_set (GladeProperty *property, const GValue *value)
|
||||
|
||||
/* if there is a custom set_property use it*/
|
||||
if (property->class->set_function)
|
||||
{
|
||||
(*property->class->set_function) (G_OBJECT (property->widget->widget),
|
||||
value);
|
||||
}
|
||||
(*property->class->set_function) (G_OBJECT (property->widget->widget), value);
|
||||
else
|
||||
{
|
||||
glade_property_set_property (property, value);
|
||||
}
|
||||
|
||||
g_value_reset (property->value);
|
||||
g_value_copy (value, property->value);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "glade-signal.h"
|
||||
#include "glade-signal-editor.h"
|
||||
#include "glade-editor.h"
|
||||
#include "glade-command.h"
|
||||
|
||||
|
||||
enum
|
||||
@ -54,11 +55,11 @@ glade_signal_editor_after_toggled (GtkCellRendererToggle *cell,
|
||||
GtkTreeModel *model = GTK_TREE_MODEL (editor->model);
|
||||
GtkTreeIter iter;
|
||||
GtkTreeIter iter_parent;
|
||||
char *handler;
|
||||
char *signal_name;
|
||||
GladeSignal *old_signal;
|
||||
GladeSignal *signal;
|
||||
GladeSignal *new_signal;
|
||||
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
|
||||
char *signal_name;
|
||||
char *handler;
|
||||
gboolean after;
|
||||
|
||||
/* get toggled iter */
|
||||
@ -74,16 +75,17 @@ glade_signal_editor_after_toggled (GtkCellRendererToggle *cell,
|
||||
}
|
||||
|
||||
old_signal = glade_signal_new (signal_name, handler, after);
|
||||
signal = glade_widget_find_signal (editor->widget, old_signal);
|
||||
new_signal = glade_signal_new (signal_name, handler, !after);
|
||||
|
||||
after = !after;
|
||||
signal->after = after;
|
||||
/* TODO: Action not yet undoable */
|
||||
glade_widget_change_signal_handler (editor->widget, old_signal, new_signal);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_AFTER, !after, -1);
|
||||
|
||||
/* set new value */
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_AFTER, after, -1);
|
||||
|
||||
/* clean up */
|
||||
glade_signal_free (old_signal);
|
||||
glade_signal_free (new_signal);
|
||||
gtk_tree_path_free (path);
|
||||
g_free (signal_name);
|
||||
g_free (handler);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -105,155 +107,164 @@ glade_signal_editor_is_valid_identifier (const char *text)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
append_slot (GtkTreeModel *model, GtkTreeIter *iter_signal)
|
||||
{
|
||||
GtkTreeIter iter_new_slot;
|
||||
GtkTreeIter iter_class;
|
||||
|
||||
gtk_tree_store_append (GTK_TREE_STORE (model), &iter_new_slot, iter_signal);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_new_slot,
|
||||
COLUMN_HANDLER, _("<Type the signal's handler here>"),
|
||||
COLUMN_AFTER, FALSE,
|
||||
COLUMN_AFTER_VISIBLE, FALSE,
|
||||
COLUMN_HANDLER_EDITABLE, TRUE,
|
||||
COLUMN_SLOT, TRUE, -1);
|
||||
gtk_tree_model_iter_parent (model, &iter_class, iter_signal);
|
||||
|
||||
/* mark the signal & class name as bold */
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), iter_signal, COLUMN_BOLD, TRUE, -1);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_class, COLUMN_BOLD, TRUE, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_slot (GtkTreeModel *model, GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeIter iter_next;
|
||||
GtkTreeIter iter_class;
|
||||
GtkTreeIter iter_signal;
|
||||
gboolean removing_top_signal_handler = FALSE;
|
||||
char *signal_name;
|
||||
|
||||
gtk_tree_model_get (model, iter, COLUMN_SIGNAL, &signal_name, -1);
|
||||
if (signal_name == NULL)
|
||||
{
|
||||
gtk_tree_model_iter_parent (model, &iter_signal, iter);
|
||||
removing_top_signal_handler = TRUE;
|
||||
}
|
||||
else
|
||||
iter_signal = *iter;
|
||||
|
||||
g_free (signal_name);
|
||||
|
||||
gtk_tree_model_iter_parent (model, &iter_class, &iter_signal);
|
||||
|
||||
/* special case for removing the handler of the first row */
|
||||
if (removing_top_signal_handler)
|
||||
gtk_tree_model_iter_nth_child (model, &iter_next, iter, 0);
|
||||
else
|
||||
{
|
||||
iter_next = *iter;
|
||||
gtk_tree_model_iter_next (model, &iter_next);
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
char *handler;
|
||||
gboolean after;
|
||||
gboolean slot;
|
||||
gboolean visible;
|
||||
|
||||
gtk_tree_model_get (model, &iter_next, COLUMN_SIGNAL, &signal_name, COLUMN_HANDLER, &handler, COLUMN_AFTER, &after, COLUMN_SLOT, &slot, COLUMN_AFTER_VISIBLE, &visible, -1);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), iter, COLUMN_SIGNAL, &signal_name, COLUMN_HANDLER, &handler, COLUMN_AFTER, &after, COLUMN_SLOT, &slot, COLUMN_AFTER_VISIBLE, &visible, -1);
|
||||
g_free (signal_name);
|
||||
g_free (handler);
|
||||
|
||||
*iter = iter_next;
|
||||
}
|
||||
while (gtk_tree_model_iter_next (model, &iter_next));
|
||||
|
||||
gtk_tree_store_remove (GTK_TREE_STORE (model), iter);
|
||||
|
||||
if (!gtk_tree_model_iter_has_child (model, &iter_signal))
|
||||
{
|
||||
/* mark the signal & class name as normal */
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_signal, COLUMN_BOLD, FALSE, -1);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_class, COLUMN_BOLD, FALSE, -1);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_void_signal_handler (const char *signal_handler)
|
||||
{
|
||||
return (signal_handler == NULL || *signal_handler == 0);
|
||||
}
|
||||
|
||||
/* TODO: this signal handler has grown well beyond what I was expecting. We should chop it */
|
||||
static void
|
||||
glade_signal_editor_cell_edited (GtkCellRendererText *cell,
|
||||
const gchar *path_str,
|
||||
const gchar *new_text,
|
||||
const gchar *new_handler,
|
||||
gpointer data)
|
||||
{
|
||||
GladeSignalEditor *editor = (GladeSignalEditor*) data;
|
||||
GtkTreeModel *model = GTK_TREE_MODEL (editor->model);
|
||||
GladeWidget *glade_widget = ((GladeSignalEditor*) data)->widget;
|
||||
GtkTreeModel *model = GTK_TREE_MODEL (((GladeSignalEditor*) data)->model);
|
||||
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
|
||||
GtkTreeIter iter;
|
||||
GtkTreeIter iter_parent;
|
||||
GtkTreeIter iter_class;
|
||||
GtkTreeIter iter_new_slot;
|
||||
GtkTreeIter *iter2;
|
||||
GladeSignal *old_signal;
|
||||
GladeSignal *signal;
|
||||
gchar *signal_name;
|
||||
gboolean after;
|
||||
GtkTreeIter iter_signal;
|
||||
char *signal_name;
|
||||
char *old_handler;
|
||||
gboolean after;
|
||||
gboolean slot;
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
iter2 = gtk_tree_iter_copy (&iter);
|
||||
gtk_tree_model_get (model, &iter, COLUMN_SIGNAL, &signal_name, COLUMN_HANDLER, &old_handler, COLUMN_AFTER, &after, COLUMN_SLOT, &slot, -1);
|
||||
|
||||
gtk_tree_model_get (model, &iter, COLUMN_SIGNAL, &signal_name, COLUMN_HANDLER, &old_handler, COLUMN_AFTER, &after, -1);
|
||||
if (signal_name == NULL)
|
||||
{
|
||||
if (!gtk_tree_model_iter_parent (model, &iter_parent, &iter))
|
||||
if (!gtk_tree_model_iter_parent (model, &iter_signal, &iter))
|
||||
g_assert (FALSE);
|
||||
|
||||
gtk_tree_model_get (model, &iter_parent, COLUMN_SIGNAL, &signal_name, -1);
|
||||
gtk_tree_model_get (model, &iter_signal, COLUMN_SIGNAL, &signal_name, -1);
|
||||
g_assert (signal_name != NULL);
|
||||
}
|
||||
else
|
||||
iter_parent = iter;
|
||||
iter_signal = iter;
|
||||
|
||||
gtk_tree_model_iter_parent (model, &iter_class, &iter_parent);
|
||||
/* false alarm */
|
||||
if (slot && is_void_signal_handler(new_handler))
|
||||
return;
|
||||
|
||||
old_signal = glade_signal_new (signal_name, old_handler, after);
|
||||
g_free (old_handler);
|
||||
g_free (signal_name);
|
||||
signal = glade_widget_find_signal (editor->widget, old_signal);
|
||||
|
||||
/* check that the new_text is a valid identifier. TODO: I don't like that! We're throwing away the text of the user
|
||||
* without even giving him an explanation. We should keep the text and say him that it's invalid, and why. The
|
||||
* text should be marked specially (maybe in red) and not added to the list of signals, but we want to keep it just
|
||||
* in case it was just a little typo. Otherwise he will write its signal handler, make the type, and lost the whole
|
||||
* string because it got substituted by <Type...> stuff */
|
||||
if (glade_signal_editor_is_valid_identifier (new_text))
|
||||
/* we're adding a new handler */
|
||||
if (slot && !is_void_signal_handler(new_handler))
|
||||
{
|
||||
if (signal == NULL)
|
||||
{
|
||||
/* we're adding a new signal */
|
||||
g_free (old_signal->handler);
|
||||
old_signal->handler = g_strdup (new_text);
|
||||
GladeSignal *new_signal = glade_signal_new (signal_name, new_handler, FALSE);
|
||||
glade_command_add_signal (glade_widget, new_signal);
|
||||
glade_signal_free (new_signal);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_HANDLER, new_handler, COLUMN_AFTER_VISIBLE, TRUE, COLUMN_SLOT, FALSE, -1);
|
||||
|
||||
glade_widget_add_signal (editor->widget, old_signal);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_HANDLER, old_signal->handler, COLUMN_AFTER_VISIBLE, TRUE, COLUMN_SLOT, FALSE, -1);
|
||||
|
||||
/* append a <Type...> slot */
|
||||
gtk_tree_store_append (GTK_TREE_STORE (model), &iter_new_slot, &iter_parent);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_new_slot,
|
||||
COLUMN_HANDLER, _("<Type the signal's handler here>"),
|
||||
COLUMN_AFTER, FALSE,
|
||||
COLUMN_AFTER_VISIBLE, FALSE,
|
||||
COLUMN_HANDLER_EDITABLE, TRUE,
|
||||
COLUMN_SLOT, TRUE, -1);
|
||||
|
||||
/* mark the signal & class name as bold */
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_parent, COLUMN_BOLD, TRUE, -1);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_class, COLUMN_BOLD, TRUE, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we're editing a signal */
|
||||
g_free (signal->handler);
|
||||
signal->handler = g_strdup (new_text);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_HANDLER, signal->handler, -1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (signal == NULL)
|
||||
{
|
||||
/* we've erased a <Type...> item, so we reput the "<Type...>" text */
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_HANDLER, _("<Type the signal's handler here>"),
|
||||
COLUMN_AFTER, FALSE, COLUMN_AFTER_VISIBLE, FALSE, COLUMN_SLOT, TRUE, -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we're erasing a signal */
|
||||
glade_widget_remove_signal (editor->widget, signal);
|
||||
/* TODO: remove the bold when we remove the last signal */
|
||||
if (memcmp(&iter_parent, &iter, sizeof(GtkTreeIter)) == 0)
|
||||
{
|
||||
/* ok, we're editing the very first signal, and thus we can't just remove the entire row,
|
||||
* as it also contains the signal's name */
|
||||
char *next_handler;
|
||||
gboolean next_after;
|
||||
gboolean next_visible;
|
||||
gboolean next_slot;
|
||||
GtkTreeIter next_iter;
|
||||
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_HANDLER, _("<Type the signal's handler here>"),
|
||||
COLUMN_AFTER, FALSE, COLUMN_AFTER_VISIBLE, FALSE, COLUMN_SLOT, TRUE, -1);
|
||||
|
||||
/* Copy the first children of iter to iter, and remove it */
|
||||
/* we're at the top, and we're erasing something. There should be at least a <Type...> child! */
|
||||
g_assert (gtk_tree_model_iter_has_child (model, &iter));
|
||||
|
||||
gtk_tree_model_iter_nth_child (model, &next_iter, &iter, 0);
|
||||
gtk_tree_model_get (model, &next_iter, COLUMN_HANDLER, &next_handler, COLUMN_AFTER, &next_after, COLUMN_AFTER_VISIBLE, &next_visible, COLUMN_SLOT, &next_slot, -1);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_HANDLER, next_handler, COLUMN_AFTER, next_after, COLUMN_AFTER_VISIBLE, next_visible, COLUMN_SLOT, next_slot, -1);
|
||||
gtk_tree_store_remove (GTK_TREE_STORE (model), &next_iter);
|
||||
g_free (next_handler);
|
||||
|
||||
/* we've erased the last handler for this signal. We should thus remove the bold */
|
||||
if (next_slot)
|
||||
{
|
||||
gboolean keep_bold = FALSE;
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_parent, COLUMN_BOLD, FALSE, -1);
|
||||
|
||||
/* loop on all the children of the class, if at least one of them still is bold,
|
||||
* keep the signal class bold */
|
||||
gtk_tree_model_iter_children (model, &iter, &iter_class);
|
||||
do
|
||||
{
|
||||
gboolean bold;
|
||||
gtk_tree_model_get (model, &iter, COLUMN_BOLD, &bold, -1);
|
||||
if (bold)
|
||||
{
|
||||
keep_bold = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (gtk_tree_model_iter_next (model, &iter));
|
||||
|
||||
if (!keep_bold)
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter_class, COLUMN_BOLD, FALSE, -1);
|
||||
}
|
||||
}
|
||||
else
|
||||
gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
|
||||
}
|
||||
/* append a <Type...> slot */
|
||||
append_slot (model, &iter_signal);
|
||||
}
|
||||
|
||||
/* we're removing a signal handler */
|
||||
if (!slot && is_void_signal_handler(new_handler))
|
||||
{
|
||||
GladeSignal *old_signal = glade_signal_new (signal_name, old_handler, after);
|
||||
glade_command_remove_signal (glade_widget, old_signal);
|
||||
glade_signal_free (old_signal);
|
||||
|
||||
remove_slot (model, &iter);
|
||||
}
|
||||
|
||||
/* we're changing a signal handler */
|
||||
if (!slot && !is_void_signal_handler(new_handler))
|
||||
{
|
||||
/* TODO: Action not yet undoable */
|
||||
GladeSignal *old_signal = glade_signal_new (signal_name, old_handler, after);
|
||||
GladeSignal *new_signal = glade_signal_new (signal_name, new_handler, after);
|
||||
|
||||
glade_widget_change_signal_handler (glade_widget, old_signal, new_signal);
|
||||
|
||||
glade_signal_free (old_signal);
|
||||
glade_signal_free (new_signal);
|
||||
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model), &iter, COLUMN_HANDLER, new_handler, COLUMN_AFTER_VISIBLE, TRUE, COLUMN_SLOT, FALSE, -1);
|
||||
}
|
||||
|
||||
gtk_tree_iter_free (iter2);
|
||||
gtk_tree_path_free (path);
|
||||
glade_signal_free (old_signal);
|
||||
g_free (signal_name);
|
||||
g_free (old_handler);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -363,7 +374,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
|
||||
GtkTreeIter parent_class;
|
||||
GtkTreeIter parent_signal;
|
||||
GtkTreePath *path_first;
|
||||
GArray *signals;
|
||||
GPtrArray *signals;
|
||||
|
||||
g_return_if_fail (GLADE_IS_SIGNAL_EDITOR (editor));
|
||||
g_return_if_fail (widget == NULL || GLADE_IS_WIDGET (widget));
|
||||
@ -371,7 +382,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
|
||||
gtk_tree_store_clear (editor->model);
|
||||
|
||||
editor->widget = widget;
|
||||
editor->class = widget ? widget->class : NULL;
|
||||
editor->class = widget ? widget->widget_class : NULL;
|
||||
|
||||
if (!widget)
|
||||
return;
|
||||
@ -393,7 +404,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
|
||||
}
|
||||
|
||||
gtk_tree_store_append (editor->model, &parent_signal, &parent_class);
|
||||
signals = glade_widget_find_signals_by_name (widget, signal->name);
|
||||
signals = glade_widget_list_signal_handlers (widget, signal->name);
|
||||
|
||||
if (!signals || signals->len == 0)
|
||||
gtk_tree_store_set (editor->model, &parent_signal,
|
||||
@ -407,7 +418,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
|
||||
{
|
||||
size_t i;
|
||||
GtkTreePath *path_parent_class;
|
||||
GladeSignal *widget_signal = (GladeSignal*) g_array_index (signals, GladeSignal*, 0);
|
||||
GladeSignal *widget_signal = (GladeSignal*) g_ptr_array_index (signals, 0);
|
||||
|
||||
/* mark the class of this signal as bold and expand it, as there is at least one signal with handler */
|
||||
gtk_tree_store_set (editor->model, &parent_class, COLUMN_BOLD, TRUE, -1);
|
||||
@ -425,7 +436,7 @@ glade_signal_editor_load_widget (GladeSignalEditor *editor,
|
||||
COLUMN_BOLD, TRUE, -1);
|
||||
for (i = 1; i < signals->len; i++)
|
||||
{
|
||||
widget_signal = (GladeSignal*) g_array_index (signals, GladeSignal*, i);
|
||||
widget_signal = (GladeSignal*) g_ptr_array_index (signals, i);
|
||||
gtk_tree_store_append (editor->model, &iter, &parent_signal);
|
||||
gtk_tree_store_set (editor->model, &iter,
|
||||
COLUMN_HANDLER, widget_signal->handler,
|
||||
|
@ -51,7 +51,7 @@ glade_signal_free (GladeSignal *signal)
|
||||
}
|
||||
|
||||
gboolean
|
||||
glade_signal_compare (GladeSignal *sig1, GladeSignal *sig2)
|
||||
glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
@ -67,7 +67,7 @@ glade_signal_compare (GladeSignal *sig1, GladeSignal *sig2)
|
||||
}
|
||||
|
||||
GladeSignal *
|
||||
glade_signal_copy (GladeSignal *signal)
|
||||
glade_signal_clone (const GladeSignal *signal)
|
||||
{
|
||||
return glade_signal_new (signal->name, signal->handler, signal->after);
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ struct _GladeSignal
|
||||
GladeSignal *glade_signal_new (const gchar *name,
|
||||
const gchar *handler,
|
||||
gboolean after);
|
||||
GladeSignal *glade_signal_copy (GladeSignal *signal);
|
||||
GladeSignal *glade_signal_clone (const GladeSignal *signal);
|
||||
void glade_signal_free (GladeSignal *signal);
|
||||
|
||||
gboolean glade_signal_compare (GladeSignal *sig1, GladeSignal *sig2);
|
||||
gboolean glade_signal_equal (GladeSignal *sig1, GladeSignal *sig2);
|
||||
|
||||
GladeXmlNode *glade_signal_write (GladeXmlContext *context, GladeSignal *signal);
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "glade-placeholder.h"
|
||||
#include "glade-widget.h"
|
||||
#include "glade-widget-class.h"
|
||||
#include "glade-property.h"
|
||||
#include "glade-property-class.h"
|
||||
|
||||
#define GLADE_UTIL_ID_EXPOSE "glade_util_id_expose"
|
||||
#define GLADE_UTIL_SELECTION_NODE_SIZE 7
|
||||
@ -478,37 +480,18 @@ glade_util_get_parent (GtkWidget *w)
|
||||
do
|
||||
{
|
||||
widget = gtk_widget_get_parent (widget);
|
||||
parent = glade_widget_get_from_gtk_widget (widget);
|
||||
|
||||
if (parent != NULL)
|
||||
return parent;
|
||||
if (widget != NULL)
|
||||
{
|
||||
parent = glade_widget_get_from_gtk_widget (widget);
|
||||
if (parent != NULL)
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
while (widget != NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
glade_util_replace_placeholder (GladePlaceholder *placeholder,
|
||||
GladeWidget *widget)
|
||||
{
|
||||
GladeWidget *parent;
|
||||
|
||||
g_return_if_fail (GLADE_IS_PLACEHOLDER (placeholder));
|
||||
g_return_if_fail (GLADE_IS_WIDGET (widget));
|
||||
|
||||
parent = glade_util_get_parent (GTK_WIDGET (placeholder));
|
||||
|
||||
if (parent->class->replace_child)
|
||||
parent->class->replace_child (GTK_WIDGET (placeholder),
|
||||
widget->widget,
|
||||
parent->widget);
|
||||
else
|
||||
g_warning ("Could not replace a placeholder because a replace "
|
||||
" function has not been implemented for \"%s\"\n",
|
||||
parent->class->name);
|
||||
}
|
||||
|
||||
/*
|
||||
* taken from gtk... maybe someday we can convince them to
|
||||
* expose gtk_container_get_all_children
|
||||
@ -606,3 +589,20 @@ glade_util_uri_list_parse (const gchar *uri_list)
|
||||
return g_list_reverse (result);
|
||||
}
|
||||
|
||||
void glade_util_object_set_property (GObject *object, GladeProperty *property)
|
||||
{
|
||||
GValue void_string = {0,};
|
||||
GValue *value = property->value;
|
||||
|
||||
if (G_VALUE_HOLDS_STRING (property->value) && g_value_get_string (property->value) == NULL)
|
||||
{
|
||||
g_value_init (&void_string, G_TYPE_STRING);
|
||||
g_value_set_static_string (&void_string, "");
|
||||
value = &void_string;
|
||||
}
|
||||
|
||||
if (property->class->set_function)
|
||||
property->class->set_function (object, value);
|
||||
else
|
||||
g_object_set_property (object, property->class->id, value);
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ void glade_util_remove_nodes (GtkWidget *widget);
|
||||
gboolean glade_util_has_nodes (GtkWidget *widget);
|
||||
|
||||
GladeWidget *glade_util_get_parent (GtkWidget *w);
|
||||
void glade_util_replace_placeholder (GladePlaceholder *placeholder, GladeWidget *widget);
|
||||
GList *glade_util_container_get_all_children (GtkContainer *container);
|
||||
void glade_util_object_set_property (GObject *object, GladeProperty *property);
|
||||
|
||||
GList *glade_util_uri_list_parse (const gchar* uri_list);
|
||||
|
||||
|
@ -2,7 +2,9 @@
|
||||
#ifndef __GLADE_WIDGET_CLASS_H__
|
||||
#define __GLADE_WIDGET_CLASS_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gmodule.h>
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include "glade-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -16,7 +18,7 @@ typedef enum {
|
||||
#define GLADE_WIDGET_CLASS(gwc) ((GladeWidgetClass *) gwc)
|
||||
#define GLADE_IS_WIDGET_CLASS(gwc) (gwc != NULL)
|
||||
|
||||
#define GLADE_WIDGET_FLAGS(gw) ((GLADE_WIDGET(gw)->class)->flags)
|
||||
#define GLADE_WIDGET_FLAGS(gw) ((GLADE_WIDGET(gw)->widget_class)->flags)
|
||||
#define GLADE_WIDGET_IS_TOPLEVEL(gw) ((GLADE_WIDGET_FLAGS(gw) & GLADE_TOPLEVEL) != 0)
|
||||
#define GLADE_WIDGET_ADD_PLACEHOLDER(gw) ((GLADE_WIDGET_FLAGS(gw) & GLADE_ADD_PLACEHOLDER) != 0)
|
||||
|
||||
@ -37,7 +39,6 @@ struct _GladeWidgetClass
|
||||
GType type; /* GType of the widget */
|
||||
|
||||
gchar *name; /* Name of the widget, for example GtkButton */
|
||||
gchar *xml_file; /* Name of the xml file for this type without a path */
|
||||
|
||||
GtkWidget *icon; /* The GtkImage icon for the widget */
|
||||
|
||||
|
1794
src/glade-widget.c
@ -2,37 +2,38 @@
|
||||
#ifndef __GLADE_WIDGET_H__
|
||||
#define __GLADE_WIDGET_H__
|
||||
|
||||
#include "glade-types.h"
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_WIDGET (glade_widget_get_type ())
|
||||
#define GLADE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_WIDGET, GladeWidget))
|
||||
#define GLADE_WIDGET_KLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_WIDGET, GladeWidgetKlass))
|
||||
#define GLADE_IS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_WIDGET))
|
||||
#define GLADE_IS_WIDGET_KLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_WIDGET))
|
||||
#define GLADE_WIDGET_GET_KLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_WIDGET, GladeWidgetKlass))
|
||||
|
||||
typedef struct _GladeWidget GladeWidget;
|
||||
typedef struct _GladeWidgetKlass GladeWidgetKlass;
|
||||
|
||||
#define GLADE_WIDGET(w) ((GladeWidget *)w)
|
||||
#define GLADE_IS_WIDGET(w) (w != NULL)
|
||||
|
||||
/* A GladeWidget is an instance of a GladeWidgetClass.
|
||||
* Each GtkWidget in the project has an associated GladeWidget.
|
||||
*/
|
||||
struct _GladeWidget
|
||||
{
|
||||
GladeWidgetClass *class; /* The class of the widget.
|
||||
* [see glade-widget-class.h ]
|
||||
*/
|
||||
GObject object;
|
||||
|
||||
GladeProject *project; /* A pointer to the project that this
|
||||
* widget belongs to. Do we really need it ?
|
||||
*/
|
||||
GladeWidgetClass *widget_class;
|
||||
GladeProject *project; /* A pointer to the project that this widget belongs to. */
|
||||
|
||||
gchar *name; /* The name of the widet. For example window1 or
|
||||
* button2. This is a unique name and is the one
|
||||
* used when loading widget with libglade
|
||||
*/
|
||||
char *name; /* The name of the widet. For example window1 or
|
||||
* button2. This is a unique name and is the one
|
||||
* used when loading widget with libglade
|
||||
*/
|
||||
|
||||
gchar *internal; /* If the widget is an internal child of
|
||||
* another widget this is the name of the
|
||||
* internal child, otherwise is NULL.
|
||||
* Internal children cannot be deleted.
|
||||
*/
|
||||
char *internal; /* If the widget is an internal child of
|
||||
* another widget this is the name of the
|
||||
* internal child, otherwise is NULL.
|
||||
* Internal children cannot be deleted.
|
||||
*/
|
||||
|
||||
GtkWidget *widget; /* A pointer to the widget that was created.
|
||||
* and is shown as a "view" of the GladeWidget.
|
||||
@ -58,59 +59,55 @@ struct _GladeWidget
|
||||
* GladeWidgetClass.
|
||||
*/
|
||||
|
||||
GHashTable *signals; /* A table with a list of GladeSignals, indexed by its name */
|
||||
GHashTable *signals; /* A table with a GPtrArray of GladeSignals (signal handlers),
|
||||
* indexed by its name */
|
||||
};
|
||||
|
||||
struct _GladeWidgetKlass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gchar *glade_widget_new_name (GladeProject *project, GladeWidgetClass *class);
|
||||
void glade_widget_set_contents (GladeWidget *widget);
|
||||
void glade_widget_connect_signals (GladeWidget *widget);
|
||||
void (*add_signal_handler) (GladeWidget *widget,
|
||||
GladeSignal *signal_handler);
|
||||
void (*remove_signal_handler) (GladeWidget *widget,
|
||||
GladeSignal *signal_handler);
|
||||
void (*change_signal_handler) (GladeWidget *widget,
|
||||
GladeSignal *old_signal_handler,
|
||||
GladeSignal *new_signal_handler);
|
||||
};
|
||||
|
||||
void glade_widget_set_packing_properties (GladeWidget *widget,
|
||||
GladeWidget *container);
|
||||
GType glade_widget_get_type (void);
|
||||
GladeWidget * glade_widget_new (GladeWidgetClass *klass, GladeProject *project);
|
||||
GladeWidget * glade_widget_new_for_internal_child (GladeWidgetClass *klass, GladeWidget *parent, GtkWidget *internal_widget, const char *internal_name);
|
||||
|
||||
GladeWidget *glade_widget_new_from_class (GladeWidgetClass *class,
|
||||
GladeProject *project);
|
||||
void glade_widget_set_name (GladeWidget *widget, const char *name);
|
||||
void glade_widget_set_internal (GladeWidget *widget, const char *internal);
|
||||
void glade_widget_set_widget (GladeWidget *widget, GtkWidget *widget_gtk);
|
||||
void glade_widget_set_project (GladeWidget *widget, GladeProject *project);
|
||||
|
||||
GladeWidget *glade_widget_new_for_internal_child (GladeWidgetClass *class,
|
||||
GladeWidget *parent,
|
||||
GtkWidget *widget,
|
||||
const gchar *internal);
|
||||
const char * glade_widget_get_name (GladeWidget *widget);
|
||||
const char * glade_widget_get_internal (GladeWidget *widget);
|
||||
GladeWidgetClass * glade_widget_get_class (GladeWidget *widget);
|
||||
GladeProject * glade_widget_get_project (GladeWidget *widget);
|
||||
GtkWidget * glade_widget_get_widget (GladeWidget *widget);
|
||||
GladeProperty * glade_widget_get_property (GladeWidget *widget, const char *id_property);
|
||||
|
||||
const gchar *glade_widget_get_name (GladeWidget *widget);
|
||||
void glade_widget_replace (GtkWidget *old_widget, GtkWidget *new_widget);
|
||||
|
||||
GladeWidgetClass *glade_widget_get_class (GladeWidget *widget);
|
||||
/* widget signals */
|
||||
void glade_widget_add_signal_handler (GladeWidget *widget, GladeSignal *signal_handler);
|
||||
void glade_widget_remove_signal_handler (GladeWidget *widget, GladeSignal *signal_handler);
|
||||
void glade_widget_change_signal_handler (GladeWidget *widget, GladeSignal *old_signal_handler, GladeSignal *new_signal_handler);
|
||||
GPtrArray * glade_widget_list_signal_handlers (GladeWidget *widget, const char *signal_name); /* array of GladeSignal* */
|
||||
|
||||
GladeProperty *glade_widget_get_property_by_class (GladeWidget *widget,
|
||||
GladePropertyClass *property_class);
|
||||
|
||||
GladeProperty *glade_widget_get_property_by_id (GladeWidget *widget,
|
||||
const gchar *id,
|
||||
gboolean packing);
|
||||
|
||||
void glade_widget_set_name (GladeWidget *widget, const gchar *name);
|
||||
|
||||
GladeWidget *glade_widget_clone (GladeWidget *widget);
|
||||
|
||||
void glade_widget_replace_with_placeholder (GladeWidget *widget,
|
||||
GladePlaceholder *placeholder);
|
||||
|
||||
GladeWidget *glade_widget_get_from_gtk_widget (GtkWidget *widget);
|
||||
|
||||
GladeWidget *glade_widget_get_parent (GladeWidget *widget);
|
||||
|
||||
/* Widget signal*/
|
||||
GladeSignal *glade_widget_find_signal (GladeWidget *widget, GladeSignal *signal);
|
||||
GArray *glade_widget_find_signals_by_name (GladeWidget *widget, const char *name);
|
||||
void glade_widget_add_signal (GladeWidget *widget, GladeSignal *signal);
|
||||
void glade_widget_remove_signal (GladeWidget *widget, GladeSignal *signal);
|
||||
|
||||
|
||||
/* Xml saving & reading */
|
||||
GladeXmlNode *glade_widget_write (GladeXmlContext *context, GladeWidget *widget);
|
||||
GladeWidget *glade_widget_new_from_node (GladeXmlNode *node, GladeProject *project);
|
||||
/* serialization */
|
||||
GladeXmlNode * glade_widget_write (GladeWidget *widget, GladeXmlContext *context);
|
||||
GladeWidget * glade_widget_read (GladeProject *project, GladeXmlNode *node);
|
||||
|
||||
/* helper functions */
|
||||
#define glade_widget_get_from_gtk_widget(w) g_object_get_data (G_OBJECT (w), "GladeWidgetDataTag")
|
||||
GladeWidget * glade_widget_get_parent (GladeWidget *widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GLADE_WIDGET_H__ */
|
||||
#endif __GLADE_WIDGET_H__
|
||||
|
@ -99,8 +99,6 @@
|
||||
#define GLADE_TAG_GLADE_WIDGET "GladeWidget"
|
||||
#define GLADE_TAG_CHILD_PROPERTY_APPLIES_FUNCTION "ChildPropertyApplies"
|
||||
|
||||
#define GLADE_WIDGET_DATA_TAG "GladeWidgetDataTag"
|
||||
|
||||
#define GLADE_MODIFY_PROPERTY_DATA "GladeModifyPropertyData"
|
||||
|
||||
#define GLADE_XML_TAG_PROJECT "glade-interface"
|
||||
|
@ -15,7 +15,8 @@ EXPORTS
|
||||
glade_cursor_init @12
|
||||
glade_catalog_load_all @13
|
||||
glade_widget_new_for_internal_child @14
|
||||
glade_widget_get_from_gtk_widget @15
|
||||
glade_widget_get_property_by_id @16
|
||||
glade_widget_get_property @15
|
||||
glade_widget_get_type @16
|
||||
glade_project_window_new_project @17
|
||||
glade_project_window_open_project @18
|
||||
glade_property_set @19
|
||||
|
@ -11,7 +11,7 @@
|
||||
<GladeWidget name="GtkToolbar" generic_name="toolbar" palette_name="Tool Bar" filename="gtktoolbar.xml"/>
|
||||
<GladeWidget name="GtkHandleBox" generic_name="handlebox" palette_name="Handle Box" />
|
||||
|
||||
<GladeWidget name="GtkLabel" generic_name="label" palette_name="Label"/>
|
||||
<GladeWidget name="GtkLabel" generic_name="label" palette_name="Label" filename="gtklabel.xml"/>
|
||||
<GladeWidget name="GtkAccelLabel" generic_name="accellabel" palette_name="Label with accelerator"/>
|
||||
|
||||
<GladeWidget name="GtkEntry" generic_name="entry" palette_name="Text Entry"/>
|
||||
@ -41,6 +41,6 @@
|
||||
<GladeWidget name="GtkVPaned" generic_name="vpaned" palette_name="Vertical Panes"/>
|
||||
|
||||
<GladeWidget name="GtkNotebook" generic_name="notebook" palette_name="Notebook" filename="gtknotebook.xml"/>
|
||||
<GladeWidget name="GtkFrame" generic_name="frame" palette_name="Frame"/>
|
||||
<GladeWidget name="GtkFrame" generic_name="frame" palette_name="Frame" filename="gtkframe.xml"/>
|
||||
|
||||
</GladeCatalog>
|
||||
|
@ -1,5 +1,7 @@
|
||||
<GladeWidgetClass>
|
||||
|
||||
<PostCreateFunction>glade_gtk_box_post_create</PostCreateFunction>
|
||||
|
||||
<Properties>
|
||||
|
||||
<Property Id="size" Name="Size" Default="3">
|
||||
@ -12,9 +14,6 @@
|
||||
<Parameter Key="PageIncrement" Value="10"/>
|
||||
<Parameter Key="ClimbRate" Value="1"/>
|
||||
</Parameters>
|
||||
<Query>
|
||||
<Question>Number of items on the box</Question>
|
||||
</Query>
|
||||
<SetFunction>glade_gtk_box_set_size</SetFunction>
|
||||
<GetFunction>glade_gtk_box_get_size</GetFunction>
|
||||
</Property>
|
||||
|
@ -23,6 +23,7 @@
|
||||
<GetFunction>ignore</GetFunction>
|
||||
</Property>
|
||||
|
||||
<Property Id="label" Default="button"/>
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
<Properties>
|
||||
<Property Id="draw-indicator" Default="True"/>
|
||||
<Property Id="label" Default="check button"/>
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
@ -1,21 +1,7 @@
|
||||
<GladeWidgetClass>
|
||||
|
||||
<Name>GtkFrame</Name>
|
||||
<GenericName>frame</GenericName>
|
||||
<Toplevel>False</Toplevel>
|
||||
<Placeholder>True</Placeholder>
|
||||
|
||||
<Properties>
|
||||
|
||||
<Property Id="border-width"/>
|
||||
<Property Id="label"/>
|
||||
<Property Id="label-xalign" Default="0.0">
|
||||
<Parameters>
|
||||
<Parameter Key="StepIncrement" Value=".05"/>
|
||||
</Parameters>
|
||||
</Property>
|
||||
<Property Id="shadow"/>
|
||||
|
||||
<Property Id="label" Default="Frame"/>
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
7
widgets/gtklabel.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<GladeWidgetClass>
|
||||
|
||||
<Properties>
|
||||
<Property Id="label" Default="label"/>
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
@ -1,16 +1,9 @@
|
||||
<GladeWidgetClass>
|
||||
<Name>GtkRadioButton</Name>
|
||||
<GenericName>radiobutton</GenericName>
|
||||
<Toplevel>False</Toplevel>
|
||||
|
||||
<Properties>
|
||||
|
||||
<Property Id="border-width"/>
|
||||
<Property Id="label"/>
|
||||
<Property Id="label" default="radio button"/>
|
||||
<Property Id="draw-indicator" Default="True"/>
|
||||
<Property Id="active"/>
|
||||
<Property Id="group" Disabled="True"/>
|
||||
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
7
widgets/gtkruler.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<GladeWidgetClass>
|
||||
<Properties>
|
||||
<Property Default="10.0" Id="upper"/>
|
||||
<Property Default="5.0" Id="position"/>
|
||||
<Property Default="10.0" Id="max-size"/>
|
||||
</Properties>
|
||||
</GladeWidgetClass>
|
@ -38,10 +38,6 @@
|
||||
-->
|
||||
</Property>
|
||||
|
||||
<Property Id="homogeneous"/>
|
||||
<Property Id="row-spacing"/>
|
||||
<Property Id="column-spacing"/>
|
||||
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
@ -1,10 +1,7 @@
|
||||
<GladeWidgetClass>
|
||||
|
||||
<Properties>
|
||||
<Property Id="active" Name="Initially On"/>
|
||||
<Property Id="label" Default="toggle button"/>
|
||||
</Properties>
|
||||
|
||||
</GladeWidgetClass>
|
||||
|
||||
|
||||
|
||||
|