Commit 552ea457 authored by Vincent Geddes's avatar Vincent Geddes

New Inspector implementation. - The Inspector no longer records session

        * gladeui/glade-inspector.[ch]: New Inspector implementation.
          - The Inspector no longer records session data. 
          - GtkTreeModel of inspector is now synchronised with project data
            in an incremental fashion, instead of being totally rebuilt on changes.
          
        * gladeui/glade-project-view.[ch]: Removed.
        
        * gladeui/glade-app.[ch]: Remove glade_app_add_project_view(). Inspectors
          are now managed by the frontend.
          
        * src/glade-project-window: A unique GladeInspector is associated with        
          each open project. These inspectors are stored in a GtkNotebook. 

svn path=/trunk/; revision=1370
parent eeb660f9
2006-06-20 Vincent Geddes <vincent.geddes@gmail.com>
* gladeui/glade-inspector.[ch]: New Inspector implementation.
- The Inspector no longer records session data.
- GtkTreeModel of inspector is now synchronised with project data
in an incremental fashion, instead of being totally rebuilt on changes.
* gladeui/glade-project-view.[ch]: Removed.
* gladeui/glade-app.[ch]: Remove glade_app_add_project_view(). Inspectors
are now managed by the frontend.
* src/glade-project-window: A unique GladeInspector is associated with
each open project. These inspectors are stored in a GtkNotebook.
2006-06-19 Tristan Van Berkom <tvb@gnome.org>
* plugins/gtk+/gtk+.xml.in: Added launch_editor action for toolbars.
......
......@@ -23,7 +23,7 @@ libgladeui_1_la_SOURCES = \
glade-parameter.c \
glade-placeholder.c \
glade-custom.c \
glade-project-view.c \
glade-inspector.c \
glade-xml-utils.c \
glade-palette.c \
glade-palette-item.c \
......@@ -85,7 +85,7 @@ libgladeuiinclude_HEADERS = \
glade.h \
glade-debug.h \
glade-project.h \
glade-project-view.h \
glade-inspector.h \
glade-parameter.h \
glade-placeholder.h \
glade-custom.h \
......
......@@ -67,8 +67,7 @@ struct _GladeAppPrivate
GladeEditor *editor; /* See glade-editor */
GladeClipboard *clipboard; /* See glade-clipboard */
GList *catalogs; /* See glade-catalog */
GList *views; /* A list of GladeProjectView item */
GList *projects; /* The list of Projects */
GKeyFile *config;/* The configuration file */
......@@ -169,7 +168,7 @@ glade_app_dispose (GObject *app)
gtk_widget_destroy (GTK_WIDGET (priv->clipboard->view));
priv->clipboard = NULL;
}
/* FIXME: Remove views and projects */
/* FIXME: Remove projects */
if (priv->config)
{
......@@ -856,19 +855,6 @@ glade_app_get_config (void)
return app->priv->config;
}
void
glade_app_add_project_view (GladeProjectView *view)
{
GladeApp *app;
g_return_if_fail (GLADE_IS_PROJECT_VIEW (view));
app = glade_app_get ();
app->priv->views = g_list_prepend (app->priv->views, view);
if (app->priv->active_project)
glade_project_view_set_project (view, app->priv->active_project);
}
gboolean
glade_app_is_project_loaded (const gchar *project_path)
{
......@@ -1074,7 +1060,6 @@ void
glade_app_set_project (GladeProject *project)
{
GladeApp *app = glade_app_get();
GList *list;
g_return_if_fail (GLADE_IS_PROJECT (project));
......@@ -1094,12 +1079,6 @@ glade_app_set_project (GladeProject *project)
app->priv->active_project = project;
for (list = app->priv->views; list; list = list->next)
{
GladeProjectView *view = list->data;
glade_project_view_set_project (view, project);
}
/* (XXX really ?) trigger the selection changed signal to update the editor */
glade_project_selection_changed (project);
......
......@@ -26,7 +26,6 @@
#include <gladeui/glade-editor.h>
#include <gladeui/glade-palette.h>
#include <gladeui/glade-clipboard.h>
#include <gladeui/glade-project-view.h>
G_BEGIN_DECLS
......@@ -135,9 +134,6 @@ void glade_app_show_properties (gboolean raise);
void glade_app_hide_properties (void);
void glade_app_add_project_view (GladeProjectView *view);
void glade_app_command_copy (void);
void glade_app_command_cut (void);
......
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* glade-inspector.h
*
* Copyright (C) 2001 Ximian, Inc.
* Copyright (C) 2007 Vincent Geddes
*
* Authors:
* Chema Celorio
* Tristan Van Berkom <tvb@gnome.org>
* Vincent Geddes <vincent.geddes@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __GLADE_INSPECTOR_H__
#define __GLADE_INSPECTOR_H__
#include <gtk/gtkvbox.h>
/* forward declaration */
struct GladeProject;
G_BEGIN_DECLS
#define GLADE_TYPE_INSPECTOR (glade_inspector_get_type ())
#define GLADE_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_INSPECTOR, GladeInspector))
#define GLADE_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_INSPECTOR, GladeInspectorClass))
#define GLADE_IS_INSPECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_INSPECTOR))
#define GLADE_IS_INSPECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_INSPECTOR))
#define GLADE_INSPECTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_INSPECTOR, GladeInspectorClass))
typedef struct _GladeInspector GladeInspector;
typedef struct _GladeInspectorClass GladeInspectorClass;
typedef struct _GladeInspectorPrivate GladeInspectorPrivate;
struct _GladeInspector
{
GtkVBox parent_instance;
GladeInspectorPrivate *priv;
};
struct _GladeInspectorClass
{
GtkVBoxClass parent_class;
void (* selection_changed) (GladeInspector *inspector);
void (* item_activated) (GladeInspector *inspector);
};
GType glade_inspector_get_type (void) G_GNUC_CONST;
GtkWidget *glade_inspector_new (void);
void glade_inspector_set_project (GladeInspector *inspector,
GladeProject *project);
GladeProject *glade_inspector_get_project (GladeInspector *inspector);
GList *glade_inspector_get_selected_items (GladeInspector *inspector);
G_END_DECLS
#endif /* __GLADE_INSPECTOR_H__ */
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __GLADE_PROJECT_VIEW_H__
#define __GLADE_PROJECT_VIEW_H__
G_BEGIN_DECLS
#define GLADE_TYPE_PROJECT_VIEW (glade_project_view_get_type ())
#define GLADE_PROJECT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_PROJECT_VIEW, GladeProjectView))
#define GLADE_PROJECT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_PROJECT_VIEW, GladeProjectViewClass))
#define GLADE_IS_PROJECT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_PROJECT_VIEW))
#define GLADE_IS_PROJECT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PROJECT_VIEW))
#define GLADE_PROJECT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_PROJECT_VIEW, GladeProjectViewClass))
/* A view of a GladeProject */
typedef struct _GladeProjectView GladeProjectView;
typedef struct _GladeProjectViewClass GladeProjectViewClass;
typedef struct _GladeProjectViewPrivate GladeProjectViewPrivate;
struct _GladeProjectView
{
GtkScrolledWindow sw; /* The parent is a scrolled window */
GladeProjectViewPrivate *priv;
};
struct _GladeProjectViewClass
{
GtkScrolledWindowClass parent_class;
void (*add_item) (GladeProjectView *view,
GladeWidget *widget);
void (*remove_item) (GladeProjectView *view,
GladeWidget *widget);
void (*widget_name_changed) (GladeProjectView *view,
GladeWidget *widget);
void (*item_activated) (GladeProjectView *view,
GladeWidget *widget);
/* Selection update is when the project changes the selection
* and we need to update our state, selection changed functions
* are the other way arround, the selection in the view changed
* and we need to let the project know about it. Chema
*/
void (*selection_update) (GladeProjectView *view,
GladeProject *project);
};
GType glade_project_view_get_type (void) G_GNUC_CONST;
GtkWidget *glade_project_view_new (void);
GladeProject *glade_project_view_get_project (GladeProjectView *view);
void glade_project_view_set_project (GladeProjectView *view, GladeProject *project);
void glade_project_view_expand_all (GladeProjectView *view);
void glade_project_view_collapse_all (GladeProjectView *view);
G_END_DECLS
#endif /* __GLADE_PROJECT_VIEW_H__ */
......@@ -38,7 +38,7 @@ typedef struct _GladeProject GladeProject;
#include <gladeui/glade-editor.h>
#include <gladeui/glade-palette.h>
#include <gladeui/glade-clipboard.h>
#include <gladeui/glade-project-view.h>
#include <gladeui/glade-inspector.h>
#include <gladeui/glade-placeholder.h>
#include <gladeui/glade-utils.h>
#include <gladeui/glade-builtins.h>
......
......@@ -30,6 +30,7 @@
#include <gladeui/glade.h>
#include <gladeui/glade-design-view.h>
#include <gladeui/glade-binding.h>
#include <gladeui/glade-inspector.h>
#include <string.h>
#include <glib/gstdio.h>
......@@ -60,6 +61,8 @@ struct _GladeProjectWindowPrivate
GladeDesignView *active_view;
gint num_tabs;
GtkWidget *inspectors_notebook;
GtkWidget *statusbar; /* A pointer to the status bar. */
guint statusbar_menu_context_id; /* The context id of the menu bar */
guint statusbar_actions_context_id; /* The context id of actions messages */
......@@ -1447,6 +1450,19 @@ glade_project_window_next_project_cb (GtkAction *action, GladeProjectWindow *win
gtk_notebook_next_page (GTK_NOTEBOOK (window->priv->notebook));
}
static void
inspector_item_activated_cb (GladeInspector *inspector,
GladeProjectWindow *gpw)
{
GList *item = glade_inspector_get_selected_items (inspector);
g_assert (GLADE_IS_WIDGET (item->data) && (item->next == NULL));
/* switch to this widget in the workspace */
glade_widget_show (GLADE_WIDGET (item->data));
g_list_free (item);
}
static void
gpw_notebook_switch_page_cb (GtkNotebook *notebook,
GtkNotebookPage *page,
......@@ -1475,6 +1491,9 @@ gpw_notebook_switch_page_cb (GtkNotebook *notebook,
gpw_refresh_title (gpw);
gpw_set_sensitivity_according_to_project (gpw, project);
/* switch to the project's inspector */
gtk_notebook_set_current_page (GTK_NOTEBOOK (gpw->priv->inspectors_notebook), page_num);
/* activate the corresponding item in the project menu */
action_name = g_strdup_printf ("Tab_%d", page_num);
action = gtk_action_group_get_action (gpw->priv->projects_list_menu_actions,
......@@ -1498,6 +1517,7 @@ gpw_notebook_tab_added_cb (GtkNotebook *notebook,
GladeProjectWindow *gpw)
{
GladeProject *project;
GtkWidget *inspector;
++gpw->priv->num_tabs;
......@@ -1515,6 +1535,18 @@ gpw_notebook_tab_added_cb (GtkNotebook *notebook,
G_CALLBACK (gpw_project_notify_handler_cb),
gpw);
/* create inspector */
inspector = glade_inspector_new ();
gtk_widget_show (inspector);
glade_inspector_set_project (GLADE_INSPECTOR (inspector), project);
g_signal_connect (inspector, "item-activated",
G_CALLBACK (inspector_item_activated_cb),
gpw);
gtk_notebook_append_page (GTK_NOTEBOOK (gpw->priv->inspectors_notebook), inspector, NULL);
gpw_set_sensitivity_according_to_project (gpw, project);
gpw_refresh_projects_list_menu (gpw);
......@@ -1532,7 +1564,8 @@ gpw_notebook_tab_removed_cb (GtkNotebook *notebook,
guint page_num,
GladeProjectWindow *gpw)
{
GladeProject *project;
GladeProject *project;
GladeInspector *inspector;
--gpw->priv->num_tabs;
......@@ -1551,6 +1584,10 @@ gpw_notebook_tab_removed_cb (GtkNotebook *notebook,
/* FIXME: this function needs to be preferably called somewhere else */
glade_app_remove_project (project);
inspector = (GladeInspector *) gtk_notebook_get_nth_page (GTK_NOTEBOOK (gpw->priv->inspectors_notebook), page_num);
gtk_notebook_remove_page (GTK_NOTEBOOK (gpw->priv->inspectors_notebook), page_num);
gpw_refresh_projects_list_menu (gpw);
gpw_refresh_title (gpw);
......@@ -2208,7 +2245,6 @@ glade_project_window_create (GladeProjectWindow *gpw)
GtkWidget *vpaned;
GtkWidget *menubar;
GtkWidget *toolbar;
GladeProjectView *project_view;
GtkWidget *statusbar;
GtkWidget *editor_item;
GtkWidget *palette;
......@@ -2289,15 +2325,13 @@ glade_project_window_create (GladeProjectWindow *gpw)
gtk_paned_pack2 (GTK_PANED (hpaned2), gpw->priv->notebook, TRUE, FALSE);
gtk_widget_show (gpw->priv->notebook);
/* project view */
project_view = GLADE_PROJECT_VIEW (glade_project_view_new ());
glade_app_add_project_view (project_view);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (project_view),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (project_view), GTK_SHADOW_IN);
dockitem = gpw_construct_dock_item (gpw, _("Inspector"), GTK_WIDGET (project_view));
/* inspectors */
gpw->priv->inspectors_notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (gpw->priv->inspectors_notebook), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (gpw->priv->inspectors_notebook), FALSE);
gtk_widget_show (gpw->priv->inspectors_notebook);
dockitem = gpw_construct_dock_item (gpw, _("Inspector"), gpw->priv->inspectors_notebook);
gtk_paned_pack1 (GTK_PANED (vpaned), dockitem, FALSE, FALSE);
gtk_widget_show_all (GTK_WIDGET (project_view));
/* editor */
editor = GTK_WIDGET (glade_app_get_editor ());
......
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