Commit cee72078 authored by Tristan Van Berkom's avatar Tristan Van Berkom

* gladeui/glade-app.[ch], gladeui/glade-command.c, gladeui/glade-editor.[ch],

	gladeui/glade-popup.c, gladeui/glade-project.c, gladeui/glade-signal-editor.c,
	gladeui/glade-widget-adaptor.c, src/glade-window.c, src/main.c:
	- Removed glade_app_get_editor(), Now the editor is not overly-refreshed by the
	  core and editors can be created at will, the core doesnt need to hold on to one.
	- Also, "gtk-doc-search" signal has been moved from the GladeEditor to the GladeApp.
parent b1605958
......@@ -34,6 +34,13 @@
for loaded widgets with a number), fixes crash when setting naming policy for
glom_developer.glade.
* gladeui/glade-app.[ch], gladeui/glade-command.c, gladeui/glade-editor.[ch],
gladeui/glade-popup.c, gladeui/glade-project.c, gladeui/glade-signal-editor.c,
gladeui/glade-widget-adaptor.c, src/glade-window.c, src/main.c:
- Removed glade_app_get_editor(), Now the editor is not overly-refreshed by the
core and editors can be created at will, the core doesnt need to hold on to one.
- Also, "gtk-doc-search" signal has been moved from the GladeEditor to the GladeApp.
2011-01-02 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-project.c: Fixed GladeProject to only ever report widgets that are
......
......@@ -58,6 +58,7 @@
enum
{
SIGNAL_EDITOR_CREATED,
DOC_SEARCH,
LAST_SIGNAL
};
......@@ -72,7 +73,6 @@ struct _GladeAppPrivate
GtkWidget *window;
GladePalette *palette; /* See glade-palette */
GladeEditor *editor; /* See glade-editor */
GladeClipboard *clipboard; /* See glade-clipboard */
GList *catalogs; /* See glade-catalog */
......@@ -158,11 +158,6 @@ glade_app_dispose (GObject * app)
{
GladeAppPrivate *priv = GLADE_APP_GET_PRIVATE (app);
if (priv->editor)
{
g_object_unref (priv->editor);
priv->editor = NULL;
}
if (priv->palette)
{
g_object_unref (priv->palette);
......@@ -382,12 +377,6 @@ glade_app_init (GladeApp * app)
app->priv->palette = (GladePalette *) glade_palette_new (app->priv->catalogs);
g_object_ref_sink (app->priv->palette);
/* Create Editor */
app->priv->editor = GLADE_EDITOR (glade_editor_new ());
g_object_ref_sink (G_OBJECT (app->priv->editor));
glade_editor_refresh (app->priv->editor);
/* Create clipboard */
app->priv->clipboard = glade_clipboard_new ();
......@@ -431,6 +420,24 @@ glade_app_class_init (GladeAppClass * klass)
NULL, NULL,
glade_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT);
/**
* GladeApp::doc-search:
* @gladeeditor: the #GladeEditor which received the signal.
* @arg1: the (#gchar *) book to search or %NULL
* @arg2: the (#gchar *) page to search or %NULL
* @arg3: the (#gchar *) search string or %NULL
*
* Emitted when the glade core requests that a doc-search be performed.
*/
glade_app_signals[DOC_SEARCH] =
g_signal_new ("doc-search",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
glade_marshal_VOID__STRING_STRING_STRING,
G_TYPE_NONE, 3,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
g_object_class_install_property
(object_class, PROP_POINTER_MODE,
g_param_spec_enum
......@@ -647,13 +654,6 @@ glade_app_get_window (void)
return app->priv->window;
}
GladeEditor *
glade_app_get_editor (void)
{
GladeApp *app = glade_app_get ();
return app->priv->editor;
}
GladePalette *
glade_app_get_palette (void)
{
......@@ -810,7 +810,6 @@ glade_app_add_project (GladeProject * project)
/* XXX I think the palette & editor should detect this by itself */
gtk_widget_set_sensitive (GTK_WIDGET (app->priv->palette), TRUE);
gtk_widget_set_sensitive (GTK_WIDGET (app->priv->editor), TRUE);
}
void
......@@ -829,11 +828,6 @@ glade_app_remove_project (GladeProject * project)
/* XXX I think the palette & editor should detect this. */
gtk_widget_set_sensitive (GTK_WIDGET (app->priv->palette), FALSE);
/* set loaded widget to NULL first so that we dont mess
* around with sensitivity of the editor children.
*/
glade_editor_load_widget (app->priv->editor, NULL);
gtk_widget_set_sensitive (GTK_WIDGET (app->priv->editor), FALSE);
}
/* Its safe to just release the project as the project emits a
......@@ -883,7 +877,7 @@ glade_app_get_pointer_mode (void)
* from the plugin backend.
*/
void
glade_app_set_accel_group (GtkAccelGroup * accel_group)
glade_app_set_accel_group (GtkAccelGroup *accel_group)
{
GladeApp *app;
g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
......@@ -904,3 +898,16 @@ glade_app_new (void)
{
return g_object_new (GLADE_TYPE_APP, NULL);
}
void
glade_app_search_docs (const gchar *book,
const gchar *page,
const gchar *search)
{
GladeApp *app;
app = glade_app_get ();
g_signal_emit (G_OBJECT (app), glade_app_signals[DOC_SEARCH], 0,
book, page, search);
}
......@@ -102,8 +102,6 @@ GList *glade_app_get_catalogs (void);
GladeCatalog *glade_app_get_catalog (const gchar *name);
GladeEditor* glade_app_get_editor (void);
GladePalette* glade_app_get_palette (void);
GladeClipboard* glade_app_get_clipboard (void);
......@@ -140,6 +138,10 @@ GtkAccelGroup *glade_app_get_accel_group (void);
GList *glade_app_get_selection (void);
void glade_app_search_docs (const gchar *book,
const gchar *page,
const gchar *search);
/* package paths */
const gchar *glade_app_get_catalogs_dir (void) G_GNUC_CONST;
......
......@@ -2220,9 +2220,6 @@ glade_command_set_project_naming_policy (GladeProject * project,
}
glade_command_pop_group ();
/* XXX Do we need this ??? */
glade_editor_refresh (glade_app_get_editor ());
}
}
......
......@@ -59,30 +59,10 @@ enum
PROP_WIDGET
};
enum
{
GTK_DOC_SEARCH,
LAST_SIGNAL
};
static GtkVBoxClass *parent_class = NULL;
static guint glade_editor_signals[LAST_SIGNAL] = { 0 };
static void glade_editor_reset_dialog (GladeEditor * editor);
void
glade_editor_search_doc_search (GladeEditor * editor,
const gchar * book,
const gchar * page, const gchar * search)
{
g_return_if_fail (GLADE_IS_EDITOR (editor));
g_signal_emit (G_OBJECT (editor),
glade_editor_signals[GTK_DOC_SEARCH], 0, book, page, search);
}
static void
glade_editor_set_property (GObject * object,
guint prop_id,
......@@ -140,8 +120,6 @@ glade_editor_class_init (GladeEditorClass * klass)
object_class->set_property = glade_editor_set_property;
object_class->get_property = glade_editor_get_property;
klass->gtk_doc_search = NULL;
/* Properties */
g_object_class_install_property
(object_class, PROP_SHOW_INFO,
......@@ -158,26 +136,6 @@ glade_editor_class_init (GladeEditorClass * klass)
_("The currently loaded widget in this editor"),
GLADE_TYPE_WIDGET, G_PARAM_READWRITE));
/**
* GladeEditor::gtk-doc-search:
* @gladeeditor: the #GladeEditor which received the signal.
* @arg1: the (#gchar *) book to search or %NULL
* @arg2: the (#gchar *) page to search or %NULL
* @arg3: the (#gchar *) search string or %NULL
*
* Emitted when the editor requests that a doc-search be performed.
*/
glade_editor_signals[GTK_DOC_SEARCH] =
g_signal_new ("gtk-doc-search",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GladeEditorClass,
gtk_doc_search),
NULL, NULL,
glade_marshal_VOID__STRING_STRING_STRING,
G_TYPE_NONE, 3,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
}
static GtkWidget *
......@@ -254,9 +212,9 @@ glade_editor_on_docs_click (GtkButton * button, GladeEditor * editor)
if (editor->loaded_widget)
{
g_object_get (editor->loaded_adaptor, "book", &book, NULL);
glade_editor_search_doc_search (editor, book,
glade_widget_adaptor_get_name (editor->loaded_adaptor),
NULL);
glade_app_search_docs (book,
glade_widget_adaptor_get_name (editor->loaded_adaptor),
NULL);
g_free (book);
}
}
......@@ -822,9 +780,8 @@ query_dialog_style_set_cb (GtkWidget * dialog,
gtk_box_set_spacing (GTK_BOX (action_area), 6);
}
gboolean
glade_editor_query_dialog (GladeEditor * editor, GladeWidget * widget)
glade_editor_query_dialog (GladeWidget * widget)
{
GladeWidgetAdaptor *adaptor;
GtkWidget *dialog, *editable, *content_area;
......@@ -832,7 +789,6 @@ glade_editor_query_dialog (GladeEditor * editor, GladeWidget * widget)
gint answer;
gboolean retval = TRUE;
g_return_val_if_fail (GLADE_IS_EDITOR (editor), FALSE);
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
adaptor = glade_widget_get_adaptor (widget);
......@@ -850,7 +806,7 @@ glade_editor_query_dialog (GladeEditor * editor, GladeWidget * widget)
GTK_RESPONSE_CANCEL, -1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
editable = glade_editor_get_editable_by_adaptor (editor, adaptor, GLADE_PAGE_QUERY);
editable = (GtkWidget *) glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_QUERY);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_box_pack_start (GTK_BOX (content_area), editable, FALSE, FALSE, 6);
......@@ -870,8 +826,6 @@ glade_editor_query_dialog (GladeEditor * editor, GladeWidget * widget)
if (answer == GTK_RESPONSE_CANCEL)
retval = FALSE;
gtk_container_remove (GTK_CONTAINER (content_area), editable);
gtk_widget_destroy (dialog);
return retval;
}
......
......@@ -112,15 +112,6 @@ struct _GladeEditorClass
{
GtkVBoxClass parent_class;
void (*add_signal) (GladeEditor *editor, const char *id_widget,
GType type_widget, guint id_signal,
const char *callback_name);
void (*gtk_doc_search) (GladeEditor *,
const gchar *,
const gchar *,
const gchar *);
};
......@@ -135,17 +126,12 @@ void glade_editor_load_widget (GladeEditor *editor,
void glade_editor_refresh (GladeEditor *editor);
gboolean glade_editor_query_dialog (GladeEditor *editor,
GladeWidget *widget);
gboolean glade_editor_query_dialog (GladeWidget *widget);
void glade_editor_show_info (GladeEditor *editor);
void glade_editor_hide_info (GladeEditor *editor);
void glade_editor_search_doc_search (GladeEditor *editor,
const gchar *book,
const gchar *page,
const gchar *search);
void glade_editor_set_signal_editor (GladeEditor *editor, GladeSignalEditor *signal_editor);
G_END_DECLS
......
......@@ -44,9 +44,7 @@ glade_popup_docs_cb (GtkMenuItem * item, GladeWidgetAdaptor * adaptor)
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
g_object_get (adaptor, "book", &book, NULL);
glade_editor_search_doc_search (glade_app_get_editor (), book,
glade_widget_adaptor_get_name (adaptor),
NULL);
glade_app_search_docs (book, glade_widget_adaptor_get_name (adaptor), NULL);
g_free (book);
}
......@@ -659,9 +657,7 @@ glade_popup_property_docs_cb (GtkMenuItem * item, GladeProperty * property)
g_object_get (adaptor, "book", &book, NULL);
glade_editor_search_doc_search (glade_app_get_editor (),
book,
g_type_name (pspec->owner_type), search);
glade_app_search_docs (book, g_type_name (pspec->owner_type), search);
g_free (book);
g_free (search);
......
......@@ -450,8 +450,6 @@ glade_project_undo_impl (GladeProject * project)
(next_cmd->group_id == 0 || next_cmd->group_id != cmd->group_id))
break;
}
glade_editor_refresh (glade_app_get_editor ());
}
static void
......@@ -472,8 +470,6 @@ glade_project_redo_impl (GladeProject * project)
(next_cmd->group_id == 0 || next_cmd->group_id != cmd->group_id))
break;
}
glade_editor_refresh (glade_app_get_editor ());
}
static GladeCommand *
......
......@@ -733,10 +733,7 @@ glade_signal_editor_devhelp_cb (GtkCellRenderer * cell,
g_object_get (signal_class->adaptor, "book", &book, NULL);
glade_editor_search_doc_search (glade_app_get_editor (),
book,
glade_widget_adaptor_get_name (signal_class->adaptor),
search);
glade_app_search_docs (book, glade_widget_adaptor_get_name (signal_class->adaptor), search);
g_free (search);
g_free (book);
......
......@@ -2668,10 +2668,8 @@ glade_widget_adaptor_create_widget_real (gboolean query,
if (query && glade_widget_adaptor_query (adaptor))
{
GladeEditor *editor = glade_app_get_editor ();
/* If user pressed cancel on query popup. */
if (!glade_editor_query_dialog (editor, gwidget))
if (!glade_editor_query_dialog (gwidget))
{
g_object_unref (G_OBJECT (gwidget));
return NULL;
......
......@@ -103,7 +103,10 @@ struct _GladeWindowPrivate
GtkWidget *inspectors_notebook;
GtkWidget *statusbar; /* A pointer to the status bar. */
GladeEditor *editor; /* The editor */
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 */
......@@ -495,7 +498,7 @@ project_selection_changed_cb (GladeProject * project, GladeWindow * window)
}
}
glade_editor_load_widget (glade_app_get_editor (), glade_widget);
glade_editor_load_widget (window->priv->editor, glade_widget);
}
static GladeDesignView *
......@@ -1747,7 +1750,11 @@ notebook_tab_removed_cb (GtkNotebook *notebook,
--window->priv->num_tabs;
if (window->priv->num_tabs == 0)
window->priv->active_view = NULL;
{
gtk_widget_set_sensitive (GTK_WIDGET (window->priv->editor), FALSE);
window->priv->active_view = NULL;
}
project = glade_design_view_get_project (view);
......@@ -2612,6 +2619,8 @@ add_project (GladeWindow * window, GladeProject * project, gboolean for_file)
gtk_notebook_set_current_page (GTK_NOTEBOOK (window->priv->notebook), -1);
refresh_notebook_tab_for_project (window, project);
gtk_widget_set_sensitive (GTK_WIDGET (window->priv->editor), TRUE);
}
void
......@@ -3278,6 +3287,10 @@ glade_window_init (GladeWindow * window)
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
/* editor */
priv->editor = GLADE_EDITOR (glade_editor_new ());
g_object_ref_sink (G_OBJECT (priv->editor));
/* menubar */
menubar = construct_menu (window);
gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, TRUE, 0);
......@@ -3366,7 +3379,7 @@ glade_window_init (GladeWindow * window)
_("Inspector"), "inspector", vpaned, TRUE);
/* editor */
dockitem = GTK_WIDGET (glade_app_get_editor ());
dockitem = GTK_WIDGET (priv->editor);
gtk_paned_pack2 (GTK_PANED (vpaned), dockitem, TRUE, FALSE);
gtk_widget_show_all (dockitem);
setup_dock (&priv->docks[DOCK_EDITOR], dockitem, 500, 700,
......@@ -3525,12 +3538,9 @@ glade_window_check_devhelp (GladeWindow * window)
if (glade_util_have_devhelp ())
{
GladeEditor *editor = glade_app_get_editor ();
glade_editor_show_info (editor);
g_signal_handlers_disconnect_by_func (editor, doc_search_cb, window);
glade_editor_show_info (window->priv->editor);
g_signal_connect (editor, "gtk-doc-search",
g_signal_connect (glade_app_get (), "doc-search",
G_CALLBACK (doc_search_cb), window);
}
......
......@@ -89,8 +89,7 @@ main (int argc, char *argv[])
option_context = g_option_context_new (NULL);
g_option_context_set_summary (option_context,
N_
("Create or edit user interface designs for GTK+ or GNOME applications."));
N_("Create or edit user interface designs for GTK+ or GNOME applications."));
g_option_context_set_translation_domain (option_context, GETTEXT_PACKAGE);
option_group = g_option_group_new ("glade",
......
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