Commit 45ad67db authored by Tristan Van Berkom's avatar Tristan Van Berkom

Fixed a warning.


	* src/glade-window.c: Fixed a warning.

also fixed some errors in previous commit.


svn path=/trunk/; revision=1991
parent d38ad3ce
......@@ -12,7 +12,9 @@
* gladeui/glade-widget-adaptor.[ch]: Added GladeCreateEditableFunc to allow backends
to define layouts of pages in the editor.
* src/glade-window.c: Fixed a warning.
2008-10-22 Juan Pablo Ugarte <juanpablougarte@gmail.com>
* plugins/gtk+/glade-gtk.c: fixed bug in glade_gtk_assistant_verify_property()
......
......@@ -31,8 +31,6 @@ static void glade_editor_table_class_init (GladeEditorTableClass *k
static void glade_editor_table_finalize (GObject *object);
static void glade_editor_table_editable_init (GladeEditableIface *iface);
static void glade_editor_table_grab_focus (GtkWidget *widget);
static void append_packing_items (GladeEditorTable *table,
GladeWidget *widget);
G_DEFINE_TYPE_WITH_CODE (GladeEditorTable, glade_editor_table, GTK_TYPE_TABLE,
G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
......@@ -147,10 +145,6 @@ glade_editor_table_load (GladeEditable *editable,
else if (table->name_entry)
gtk_entry_set_text (GTK_ENTRY (table->name_entry), "");
/* If this is a packing page, we need to generate the properties here... */
if (table->loaded_widget && table->type == GLADE_PAGE_PACKING)
append_packing_items (table, table->loaded_widget);
/* Sync up properties, even if widget is NULL */
for (list = table->properties; list; list = list->next)
{
......@@ -205,14 +199,19 @@ static GList *
get_sorted_properties (GladeWidgetAdaptor *adaptor,
GladeEditorPageType type)
{
GList *l, *list = NULL;
for (l = adaptor->properties; l && l->data; l = g_list_next (l))
GList *l, *list = NULL, *properties;
properties = (type == GLADE_PAGE_PACKING) ? adaptor->packing_props : adaptor->properties;
for (l = properties; l && l->data; l = g_list_next (l))
{
GladePropertyClass *klass = l->data;
/* Collect properties in our domain, query dialogs are allowed editor invisible properties */
if (GLADE_PROPERTY_CLASS_IS_TYPE (klass, type) &&
/* Collect properties in our domain, query dialogs are allowed editor
* invisible properties, allow adaptors to filter out properties from
* the GladeEditorTable using the "custom-layout" attribute.
*/
if (!klass->custom_layout && GLADE_PROPERTY_CLASS_IS_TYPE (klass, type) &&
(glade_property_class_is_visible (klass) || type != GLADE_PAGE_QUERY))
list = g_list_prepend (list, klass);
......@@ -270,26 +269,6 @@ append_items (GladeEditorTable *table,
table->properties = g_list_reverse (table->properties);
}
static void
append_packing_items (GladeEditorTable *table,
GladeWidget *widget)
{
GladeEditorProperty *eprop;
GladeProperty *property;
GList *list;
for (list = widget->packing_properties; list != NULL; list = list->next)
{
property = list->data;
eprop = append_item (table, property->klass, FALSE);
table->properties = g_list_prepend (table->properties, eprop);
}
table->properties = g_list_reverse (table->properties);
}
static void
widget_name_edited (GtkWidget *editable, GladeEditorTable *table)
{
......
......@@ -387,7 +387,6 @@ glade_editor_init (GladeEditor *editor)
editor->page_signals = glade_editor_notebook_page (editor, _("_Signals"));
editor->page_atk = glade_editor_notebook_page (editor, _("Accessibility"));
editor->editables = NULL;
editor->packing_page = NULL;
editor->loading = FALSE;
editor->class_field = glade_editor_setup_class_field (editor);
......@@ -474,7 +473,6 @@ glade_editor_get_editable_by_adaptor (GladeEditor *editor,
GList *list;
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
g_return_val_if_fail (type != GLADE_PAGE_PACKING, NULL);
for (list = editor->editables; list; list = list->next)
{
......@@ -488,16 +486,19 @@ glade_editor_get_editable_by_adaptor (GladeEditor *editor,
editable = (GtkWidget *)glade_widget_adaptor_create_editable (adaptor, type);
g_return_val_if_fail (editable != NULL, NULL);
g_object_ref_sink (editable);
g_object_set_data (G_OBJECT (editable), "glade-editor-page-type", GINT_TO_POINTER (type));
g_object_set_data (G_OBJECT (editable), "glade-widget-adaptor", adaptor);
editor->editables = g_list_prepend (editor->editables, editable);
if (type != GLADE_PAGE_PACKING)
{
editor->editables = g_list_prepend (editor->editables, editable);
g_object_ref_sink (editable);
}
return editable;
}
static void
static GtkWidget *
glade_editor_load_editable_in_page (GladeEditor *editor,
GladeWidgetAdaptor *adaptor,
GladeEditorPageType type)
......@@ -529,24 +530,20 @@ glade_editor_load_editable_in_page (GladeEditor *editor,
/* Remove the editable (this will destroy on packing pages) */
if (GTK_BIN (container)->child)
{
gtk_widget_hide (GTK_BIN (container)->child);
gtk_container_remove (container, GTK_BIN (container)->child);
}
if (!adaptor)
return;
if (type != GLADE_PAGE_PACKING)
editable = glade_editor_get_editable_by_adaptor (editor, adaptor, type);
else
{
/* Dont take a ref for packing pages, they are owned by thier container
* until we update it.
*/
editable = (GtkWidget *)glade_widget_adaptor_create_editable (adaptor, type);
editor->packing_page = editable;
}
return NULL;
if ((editable = glade_editor_get_editable_by_adaptor (editor, adaptor, type)) == NULL)
return NULL;
/* Attach the new page */
gtk_container_add (GTK_CONTAINER (container), editable);
gtk_widget_show (editable);
/* Enable tabbed keynav in the editor */
scrolled_window = gtk_widget_get_parent (GTK_WIDGET (container));
......@@ -563,8 +560,10 @@ glade_editor_load_editable_in_page (GladeEditor *editor,
adj = gtk_scrolled_window_get_hadjustment
(GTK_SCROLLED_WINDOW (scrolled_window));
gtk_container_set_focus_hadjustment
(GTK_CONTAINER (editable), adj);
gtk_container_set_focus_hadjustment
(GTK_CONTAINER (editable), adj);
return editable;
}
static void
......@@ -583,7 +582,6 @@ glade_editor_load_widget_class (GladeEditor *editor, GladeWidgetAdaptor *adaptor
glade_editor_load_editable_in_page (editor, adaptor, GLADE_PAGE_GENERAL);
glade_editor_load_editable_in_page (editor, adaptor, GLADE_PAGE_COMMON);
glade_editor_load_editable_in_page (editor, adaptor, GLADE_PAGE_PACKING);
glade_editor_load_editable_in_page (editor, adaptor, GLADE_PAGE_ATK);
glade_editor_load_signal_page (editor);
......@@ -608,8 +606,14 @@ glade_editor_load_editable (GladeEditor *editor,
{
GtkWidget *editable;
if (type == GLADE_PAGE_PACKING)
editable = editor->packing_page;
/* Use the parenting adaptor for packing pages... so deffer creating the widgets
* until load time.
*/
if (type == GLADE_PAGE_PACKING && widget->parent)
{
GladeWidgetAdaptor *adaptor = widget->parent->adaptor;
editable = glade_editor_load_editable_in_page (editor, adaptor, GLADE_PAGE_PACKING);
}
else
editable = glade_editor_get_editable_by_adaptor
(editor, widget->adaptor, type);
......
......@@ -77,17 +77,18 @@ glade_property_class_new (gpointer handle)
property_class->query = FALSE;
property_class->optional = FALSE;
property_class->optional_default = FALSE;
property_class->is_modified = FALSE;
property_class->common = FALSE;
property_class->packing = FALSE;
property_class->is_modified = FALSE;
property_class->atk = FALSE;
property_class->visible = TRUE;
property_class->custom_layout = FALSE;
property_class->save = TRUE;
property_class->save_always = FALSE;
property_class->ignore = FALSE;
property_class->needs_sync = FALSE;
property_class->themed_icon = FALSE;
property_class->translatable = FALSE;
property_class->atk = FALSE;
property_class->virt = TRUE;
property_class->transfer_on_paste = FALSE;
property_class->weight = -1.0;
......@@ -1411,16 +1412,17 @@ glade_property_class_update_from_node (GladeXmlNode *node,
klass->parameters = glade_parameter_list_new_from_node (klass->parameters, child);
klass->construct_only = glade_xml_get_property_boolean (node, GLADE_TAG_CONSTRUCT_ONLY, klass->construct_only);
klass->translatable = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSLATABLE, klass->translatable);
klass->common = glade_xml_get_property_boolean (node, GLADE_TAG_COMMON, klass->common);
klass->optional = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL, klass->optional);
klass->query = glade_xml_get_property_boolean (node, GLADE_TAG_QUERY, klass->query);
klass->save = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE, klass->save);
klass->visible = glade_xml_get_property_boolean (node, GLADE_TAG_VISIBLE, klass->visible);
klass->ignore = glade_xml_get_property_boolean (node, GLADE_TAG_IGNORE, klass->ignore);
klass->needs_sync = glade_xml_get_property_boolean (node, GLADE_TAG_NEEDS_SYNC, klass->needs_sync);
klass->themed_icon = glade_xml_get_property_boolean (node, GLADE_TAG_THEMED_ICON, klass->themed_icon);
klass->weight = glade_xml_get_property_double (node, GLADE_TAG_WEIGHT, klass->weight);
klass->translatable = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSLATABLE, klass->translatable);
klass->common = glade_xml_get_property_boolean (node, GLADE_TAG_COMMON, klass->common);
klass->optional = glade_xml_get_property_boolean (node, GLADE_TAG_OPTIONAL, klass->optional);
klass->query = glade_xml_get_property_boolean (node, GLADE_TAG_QUERY, klass->query);
klass->save = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE, klass->save);
klass->visible = glade_xml_get_property_boolean (node, GLADE_TAG_VISIBLE, klass->visible);
klass->custom_layout = glade_xml_get_property_boolean (node, GLADE_TAG_CUSTOM_LAYOUT, klass->custom_layout);
klass->ignore = glade_xml_get_property_boolean (node, GLADE_TAG_IGNORE, klass->ignore);
klass->needs_sync = glade_xml_get_property_boolean (node, GLADE_TAG_NEEDS_SYNC, klass->needs_sync);
klass->themed_icon = glade_xml_get_property_boolean (node, GLADE_TAG_THEMED_ICON, klass->themed_icon);
klass->weight = glade_xml_get_property_double (node, GLADE_TAG_WEIGHT, klass->weight);
klass->transfer_on_paste = glade_xml_get_property_boolean (node, GLADE_TAG_TRANSFER_ON_PASTE, klass->transfer_on_paste);
klass->save_always = glade_xml_get_property_boolean (node, GLADE_TAG_SAVE_ALWAYS, klass->save_always);
klass->parentless_widget = glade_xml_get_property_boolean (node, GLADE_TAG_PARENTLESS_WIDGET, klass->parentless_widget);
......
......@@ -135,8 +135,16 @@ struct _GladePropertyClass
* that are assigned initial values in composite widgets
* or derived widget code).
*/
gboolean visible; /* Whether or not to show this property in the editor
gboolean visible; /* Whether or not to show this property in the editor &
* reset dialog.
*/
gboolean custom_layout; /* Properties marked as custom_layout will not be included
* in a base #GladeEditorTable implementation (use this
* for properties you want to layout in custom ways in
* a #GladeEditable widget
*/
gboolean ignore; /* When true, we will not sync the object when the property
* changes, or load values from the object.
*/
......
......@@ -158,6 +158,7 @@ typedef enum {
#define GLADE_TAG_OPTIONAL "optional"
#define GLADE_TAG_OPTIONAL_DEFAULT "optional-default"
#define GLADE_TAG_VISIBLE "visible"
#define GLADE_TAG_CUSTOM_LAYOUT "custom-layout"
#define GLADE_TAG_EXPANDED "expanded"
#define GLADE_TAG_GENERIC_NAME "generic-name"
#define GLADE_TAG_NAME "name"
......
......@@ -544,8 +544,8 @@ activate_action (GtkToolButton *toolbutton,
static void
action_notify_sensitive (GObject *gobject,
GParamSpec *arg1,
GtkWidget *item)
GParamSpec *arg1,
GtkWidget *item)
{
GladeWidgetAction *action = GLADE_WIDGET_ACTION (gobject);
gtk_widget_set_sensitive (item, action->sensitive);
......@@ -2957,7 +2957,6 @@ glade_window_init (GladeWindow *window)
GtkWidget *hpaned2;
GtkWidget *vpaned;
GtkWidget *menubar;
GtkWidget *editor_item;
GtkWidget *palette;
GtkWidget *dockitem;
GtkWidget *widget;
......@@ -3074,12 +3073,6 @@ glade_window_init (GladeWindow *window)
gtk_widget_show (vbox);
/* devhelp */
editor_item = gtk_ui_manager_get_widget (priv->ui,
"/MenuBar/ViewMenu/PropertyEditorHelp");
gtk_widget_set_sensitive (editor_item, FALSE);
/* recent files */
priv->recent_manager = gtk_recent_manager_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)));
......
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