Commit 08bb853e authored by Tristan Van Berkom's avatar Tristan Van Berkom

Exposed doc_search() command for palette popup


	* gladeui/glade-editor.[ch]: Exposed doc_search() command for palette popup

	* gladeui/glade-popup.[ch]: Added glade_popup_palette_pop(), with add
	  widget as toplevel feature & doc search feature.

	* gladeui/glade-palette-item.c: Handle right-click for popup

	* gladeui/glade-inspector.c: Make inspector list widgets in natural order

	* gladeui/glade-project.c: Fixed widget order list (bug 422823)

	* gladeui/glade-gtk.c: Fixed widget order inside GtkTable
	  (bug 422823 - patch by Pavel Kostyuchenko)


svn path=/trunk/; revision=1919
parent 0413a950
2008-09-17 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-editor.[ch]: Exposed doc_search() command for palette popup
* gladeui/glade-popup.[ch]: Added glade_popup_palette_pop(), with add
widget as toplevel feature & doc search feature.
* gladeui/glade-palette-item.c: Handle right-click for popup
* gladeui/glade-inspector.c: Make inspector list widgets in natural order
* gladeui/glade-project.c: Fixed widget order list (bug 422823)
* gladeui/glade-gtk.c: Fixed widget order inside GtkTable
(bug 422823 - patch by Pavel Kostyuchenko)
2008-09-16 Pavel Kostyuchenko <ShprotX@gmail.com>
Patch adds support for non GtkWindow toplevel project widgets and handles
......
......@@ -275,7 +275,7 @@ glade_editor_property_create_info_button (GladeEditorProperty *eprop)
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_set_tooltip_text (button, _("View GTK+ documentation for this property"));
gtk_widget_set_tooltip_text (button, _("View documentation for this property"));
return button;
}
......
......@@ -70,6 +70,22 @@ 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_gtk_doc_search_cb (GladeEditorProperty *eprop,
const gchar *book,
......@@ -78,9 +94,7 @@ glade_editor_gtk_doc_search_cb (GladeEditorProperty *eprop,
GladeEditor *editor)
{
/* Just act as a hub for search signals here */
g_signal_emit (G_OBJECT (editor),
glade_editor_signals[GTK_DOC_SEARCH],
0, book, page, search);
glade_editor_search_doc_search (editor, book, page, search);
}
static void
......@@ -261,9 +275,9 @@ glade_editor_on_docs_click (GtkButton *button,
if (editor->loaded_widget)
{
g_object_get (editor->loaded_widget->adaptor, "book", &book, NULL);
g_signal_emit (G_OBJECT (editor),
glade_editor_signals[GTK_DOC_SEARCH],
0, book, editor->loaded_widget->adaptor->name, NULL);
glade_editor_search_doc_search (editor, book,
editor->loaded_widget->adaptor->name,
NULL);
g_free (book);
}
}
......
......@@ -221,6 +221,10 @@ void glade_editor_hide_info (GladeEditor *editor);
void glade_editor_hide_context_info (GladeEditor *editor);
void glade_editor_search_doc_search (GladeEditor *editor,
const gchar *book,
const gchar *page,
const gchar *search);
G_END_DECLS
......
......@@ -333,6 +333,7 @@ update_model (GladeInspector *inspector)
if (gwidget->parent == NULL)
toplevels = g_list_prepend (toplevels, object);
}
toplevels = g_list_reverse (toplevels);
/* recursively fill model */
fill_model (priv->model, toplevels, NULL);
......
......@@ -32,7 +32,7 @@
#include "glade.h"
#include "glade-palette-item.h"
#include "glade-popup.h"
#define GLADE_PALETTE_ITEM_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object),\
GLADE_TYPE_PALETTE_ITEM, \
......@@ -336,17 +336,35 @@ glade_palette_item_dispose (GObject *object)
G_OBJECT_CLASS (glade_palette_item_parent_class)->dispose (object);
}
static gboolean
glade_palette_item_button_press (GtkWidget *widget,
GdkEventButton *event)
{
if (event->type == GDK_BUTTON_PRESS && event->button == 3)
{
GladePaletteItemPrivate *priv = GLADE_PALETTE_ITEM_GET_PRIVATE (widget);
glade_popup_palette_pop (priv->adaptor, event);
}
return GTK_WIDGET_CLASS (glade_palette_item_parent_class)->button_press_event (widget, event);
}
static void
glade_palette_item_class_init (GladePaletteItemClass *klass)
{
GObjectClass *object_class;
GObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = G_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
object_class->get_property = glade_palette_item_get_property;
object_class->set_property = glade_palette_item_set_property;
object_class->dispose = glade_palette_item_dispose;
widget_class->button_press_event = glade_palette_item_button_press;
g_object_class_install_property (object_class,
PROP_ADAPTOR,
g_param_spec_object ("adaptor",
......
......@@ -95,11 +95,11 @@ glade_popup_placeholder_add_cb (GtkMenuItem *item, GladePlaceholder *placeholder
static void
glade_popup_root_add_cb (GtkMenuItem *item, gpointer *user_data)
{
GladeWidgetAdaptor *adaptor;
GladePalette *palette;
GladeWidgetAdaptor *adaptor = (GladeWidgetAdaptor *)user_data;
GladePalette *palette = glade_app_get_palette ();
palette = glade_app_get_palette ();
adaptor = glade_palette_get_current_item (palette);
if (!adaptor)
adaptor = glade_palette_get_current_item (palette);
g_return_if_fail (adaptor != NULL);
glade_palette_create_root_widget (palette, adaptor);
......@@ -196,6 +196,20 @@ glade_popup_clipboard_delete_cb (GtkMenuItem *item, GladeWidget *widget)
glade_app_command_delete_clipboard ();
}
static void
glade_popup_docs_cb (GtkMenuItem *item,
GladeWidgetAdaptor *adaptor)
{
gchar *book;
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, adaptor->name, NULL);
g_free (book);
}
/********************************************************
POPUP BUILDING
*******************************************************/
......@@ -399,7 +413,7 @@ glade_popup_create_menu (GladeWidget *widget,
tmp_placeholder = find_placeholder (glade_widget_get_object (widget));
glade_popup_append_item (popup_menu, NULL, _("_Add widget here"), tmp_placeholder != NULL,
glade_popup_placeholder_add_cb, tmp_placeholder);
glade_popup_append_item (popup_menu, NULL, _("Add widget as _root"), TRUE,
glade_popup_append_item (popup_menu, NULL, _("Add widget as _toplevel"), TRUE,
glade_popup_root_add_cb, NULL);
}
......@@ -578,6 +592,46 @@ glade_popup_clipboard_pop (GladeWidget *widget,
NULL, NULL, button, event_time);
}
void
glade_popup_palette_pop (GladeWidgetAdaptor *adaptor,
GdkEventButton *event)
{
GtkWidget *popup_menu;
gchar *book = NULL;
gint button;
gint event_time;
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
popup_menu = gtk_menu_new ();
glade_popup_append_item (popup_menu, NULL, _("Add widget as _toplevel"), TRUE,
glade_popup_root_add_cb, adaptor);
g_object_get (adaptor, "book", &book, NULL);
if (book)
glade_popup_append_item (popup_menu, NULL, _("Read _documentation"), TRUE,
glade_popup_docs_cb, adaptor);
g_free (book);
if (event)
{
button = event->button;
event_time = event->time;
}
else
{
button = 0;
event_time = gtk_get_current_event_time ();
}
gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
NULL, NULL, button, event_time);
}
void
glade_popup_simple_pop (GdkEventButton *event)
{
......
......@@ -14,13 +14,15 @@ void glade_popup_placeholder_pop (GladePlaceholder *placeholder,
void glade_popup_clipboard_pop (GladeWidget *widget,
GdkEventButton *event);
void glade_popup_palette_pop (GladeWidgetAdaptor *adaptor,
GdkEventButton *event);
gint glade_popup_action_populate_menu (GtkWidget *menu,
GladeWidget *widget,
GladeWidgetAction *action,
gboolean packing);
void
glade_popup_simple_pop (GdkEventButton *event);
void glade_popup_simple_pop (GdkEventButton *event);
G_END_DECLS
......
......@@ -1892,7 +1892,7 @@ glade_project_add_object (GladeProject *project,
g_signal_connect (G_OBJECT (gwidget), "notify",
(GCallback) glade_project_on_widget_notify, project);
project->priv->objects = g_list_prepend (project->priv->objects, g_object_ref (object));
project->priv->objects = g_list_append (project->priv->objects, g_object_ref (object));
g_signal_emit (G_OBJECT (project),
glade_project_signals [ADD_WIDGET],
......@@ -2379,7 +2379,7 @@ glade_project_required_libs (GladeProject *project)
required = g_list_prepend (required, catalog);
}
}
return required;
return g_list_reverse (required);
}
#define GLADE_XML_COMMENT "Generated with "PACKAGE_NAME
......
......@@ -2645,6 +2645,31 @@ glade_gtk_table_refresh_placeholders (GtkTable *table)
gtk_container_check_resize (GTK_CONTAINER (table));
}
static void
gtk_table_children_callback (GtkWidget *widget,
gpointer client_data)
{
GList **children;
children = (GList**) client_data;
*children = g_list_prepend (*children, widget);
}
GList *
glade_gtk_table_get_children (GladeWidgetAdaptor *adaptor,
GtkContainer *container)
{
GList *children = NULL;
g_return_val_if_fail (GTK_IS_TABLE (container), NULL);
gtk_container_forall (container,
gtk_table_children_callback,
&children);
/* GtkTable has the children list already reversed */
return children;
}
void
glade_gtk_table_add_child (GladeWidgetAdaptor *adaptor,
......
......@@ -1038,6 +1038,7 @@ embedded in another object</_tooltip>
<post-create-function>glade_gtk_table_post_create</post-create-function>
<child-set-property-function>glade_gtk_table_set_child_property</child-set-property-function>
<child-verify-function>glade_gtk_table_child_verify_property</child-verify-function>
<get-children-function>glade_gtk_table_get_children</get-children-function>
<add-child-function>glade_gtk_table_add_child</add-child-function>
<remove-child-function>glade_gtk_table_remove_child</remove-child-function>
<replace-child-function>glade_gtk_table_replace_child</replace-child-function>
......
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