Ejemplo n.º 1
0
static void
glade_tree_view_editor_load (GladeEditable * editable, GladeWidget * widget)
{
  GladeTreeViewEditor *view_editor = GLADE_TREE_VIEW_EDITOR (editable);
  GladeWidget *model_widget;

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

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

  if (view_editor->embed_list_store && view_editor->embed_tree_store)
    {
      gtk_widget_hide (view_editor->no_model_message);
      gtk_widget_hide (view_editor->embed_list_store);
      gtk_widget_hide (view_editor->embed_tree_store);
      glade_editable_load (GLADE_EDITABLE (view_editor->embed_list_store),
                           NULL);
      glade_editable_load (GLADE_EDITABLE (view_editor->embed_tree_store),
                           NULL);

      /* Finalize safe code here... */
      if (widget && (model_widget = get_model_widget (widget)))
        {
          if (GTK_IS_LIST_STORE (glade_widget_get_object (model_widget)))
            {
              gtk_widget_show (view_editor->embed_list_store);
              glade_editable_load (GLADE_EDITABLE
                                   (view_editor->embed_list_store),
                                   model_widget);
            }
          else if (GTK_IS_TREE_STORE (glade_widget_get_object (model_widget)))
            {
              gtk_widget_show (view_editor->embed_tree_store);
              glade_editable_load (GLADE_EDITABLE
                                   (view_editor->embed_tree_store),
                                   model_widget);
            }
          else
            gtk_widget_show (view_editor->no_model_message);
        }
      else
        gtk_widget_show (view_editor->no_model_message);
    }
}
Ejemplo n.º 2
0
static void
    glade_sheet_editor_load (GladeEditable *editable, GladeWidget   *widget)
{
    GladeSheetEditor *view_editor = GLADE_SHEET_EDITOR (editable);
    GladeWidget *model_widget;

    /* Since we watch the project*/
    if (view_editor->loaded_widget)
    {
        g_signal_handlers_disconnect_by_func (G_OBJECT (view_editor->loaded_widget->project),
                                              G_CALLBACK (project_changed), view_editor);

        /* The widget could die unexpectedly... */
        g_object_weak_unref (G_OBJECT (view_editor->loaded_widget->project),
                             (GWeakNotify)project_finalized,
                             view_editor);
    }

    /* Mark our widget... */
    view_editor->loaded_widget = widget;

    if (view_editor->loaded_widget)
    {
        /* This fires for undo/redo */
        g_signal_connect (G_OBJECT (view_editor->loaded_widget->project), "changed",
                          G_CALLBACK (project_changed), view_editor);

        /* The widget/project could die unexpectedly... */
        g_object_weak_ref (G_OBJECT (view_editor->loaded_widget->project),
                           (GWeakNotify) project_finalized,
                           view_editor);
    }

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

    if (view_editor->embed_list_store && view_editor->embed_tree_store)
    {
        gtk_widget_hide (view_editor->no_model_message);
        gtk_widget_hide (view_editor->embed_list_store);
        gtk_widget_hide (view_editor->embed_tree_store);
        glade_editable_load (GLADE_EDITABLE (view_editor->embed_list_store), NULL);
        glade_editable_load (GLADE_EDITABLE (view_editor->embed_tree_store), NULL);

        /* Finalize safe code here... */
        if (widget && (model_widget = get_model_widget (widget)))
        {
            if (GTK_IS_LIST_STORE (model_widget->object))
            {
                gtk_widget_show (view_editor->embed_list_store);
                glade_editable_load (GLADE_EDITABLE (view_editor->embed_list_store), model_widget);
            }
            else if (GTK_IS_TREE_STORE (model_widget->object))
            {
                gtk_widget_show (view_editor->embed_tree_store);
                glade_editable_load (GLADE_EDITABLE (view_editor->embed_tree_store), model_widget);
            }
            else
                gtk_widget_show (view_editor->no_model_message);
        }
        else
            gtk_widget_show (view_editor->no_model_message);
    }
}