Exemplo n.º 1
0
static void
glade_tool_item_group_editor_load (GladeEditable *editable, GladeWidget *widget)
{
  GladeToolItemGroupEditor *group_editor = GLADE_TOOL_ITEM_GROUP_EDITOR (editable);
  gboolean custom_label = FALSE;
  GList *l;

  /* Chain up to default implementation */
  parent_editable_iface->load (editable, widget);

  /* load the embedded editable... */
  if (group_editor->embed)
    glade_editable_load (GLADE_EDITABLE (group_editor->embed), widget);

  for (l = group_editor->properties; l; l = l->next)
    glade_editor_property_load_by_widget (GLADE_EDITOR_PROPERTY (l->data),
                                          widget);


  if (widget)
    {
      glade_widget_property_get (widget, "custom-label", &custom_label);

      if (custom_label)
        gtk_toggle_button_set_active
            (GTK_TOGGLE_BUTTON (group_editor->label_widget_radio), TRUE);
      else
        gtk_toggle_button_set_active
            (GTK_TOGGLE_BUTTON (group_editor->label_radio), TRUE);
    }
}
Exemplo n.º 2
0
static void
glade_editor_table_realize (GtkWidget *widget)
{
  GladeEditorTable *table = GLADE_EDITOR_TABLE (widget);
  GList *list;
  GladeEditorProperty *property;

  GTK_WIDGET_CLASS (glade_editor_table_parent_class)->realize (widget);

  /* Sync up properties, even if widget is NULL */
  for (list = table->priv->properties; list; list = list->next)
    {
      property = list->data;
      glade_editor_property_load_by_widget (property, table->priv->loaded_widget);
    }
}
Exemplo n.º 3
0
static void
glade_editor_table_load (GladeEditable *editable, GladeWidget *widget)
{
  GladeEditorTable *table = GLADE_EDITOR_TABLE (editable);
  GladeEditorProperty *property;
  GList *list;

  /* Setup the table the first time the widget is loaded */
  if (widget && table->priv->adaptor == NULL)
    {
      table->priv->adaptor = glade_widget_get_adaptor (widget);

      if (table->priv->type == GLADE_PAGE_GENERAL)
	append_name_field (table);

      append_items (table, table->priv->adaptor, table->priv->type);
    }

  /* abort mission */
  if (table->priv->loaded_widget == widget)
    return;

  if (table->priv->loaded_widget)
    {
      g_signal_handlers_disconnect_by_func (G_OBJECT (table->priv->loaded_widget),
                                            G_CALLBACK (widget_name_changed),
                                            table);
      g_signal_handlers_disconnect_by_func (G_OBJECT (table->priv->loaded_widget),
                                            G_CALLBACK (widget_composite_changed),
                                            table);

      /* The widget could die unexpectedly... */
      g_object_weak_unref (G_OBJECT (table->priv->loaded_widget),
                           (GWeakNotify) widget_finalized, table);
    }

  table->priv->loaded_widget = widget;

  BLOCK_NAME_ENTRY_CB (table);

  if (table->priv->loaded_widget)
    {
      g_signal_connect (G_OBJECT (table->priv->loaded_widget), "notify::name",
                        G_CALLBACK (widget_name_changed), table);

      g_signal_connect (G_OBJECT (table->priv->loaded_widget), "notify::composite",
                        G_CALLBACK (widget_composite_changed), table);

      /* The widget could die unexpectedly... */
      g_object_weak_ref (G_OBJECT (table->priv->loaded_widget),
                         (GWeakNotify) widget_finalized, table);

      if (table->priv->composite_check)
	{
	  GObject *object = glade_widget_get_object (table->priv->loaded_widget);

	  if (GTK_IS_WIDGET (object) && 
	      glade_widget_get_parent (table->priv->loaded_widget) == NULL)
	    gtk_widget_show (table->priv->composite_check);
	  else
	    gtk_widget_hide (table->priv->composite_check);
	}

      if (table->priv->name_entry)
        gtk_entry_set_text (GTK_ENTRY (table->priv->name_entry), 
			    glade_widget_get_name (widget));

      if (table->priv->name_label)
	widget_composite_changed (widget, NULL, table);
    }
  else if (table->priv->name_entry)
    gtk_entry_set_text (GTK_ENTRY (table->priv->name_entry), "");

  UNBLOCK_NAME_ENTRY_CB (table);

  /* Sync up properties, even if widget is NULL */
  for (list = table->priv->properties; list; list = list->next)
    {
      property = list->data;
      glade_editor_property_load_by_widget (property, widget);
    }
}