glade3 r1919 - in trunk: . gladeui plugins/gtk+
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1919 - in trunk: . gladeui plugins/gtk+
- Date: Wed, 17 Sep 2008 18:21:55 +0000 (UTC)
Author: tvb
Date: Wed Sep 17 18:21:55 2008
New Revision: 1919
URL: http://svn.gnome.org/viewvc/glade3?rev=1919&view=rev
Log:
* 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)
Modified:
trunk/ChangeLog
trunk/gladeui/glade-editor-property.c
trunk/gladeui/glade-editor.c
trunk/gladeui/glade-editor.h
trunk/gladeui/glade-inspector.c
trunk/gladeui/glade-palette-item.c
trunk/gladeui/glade-popup.c
trunk/gladeui/glade-popup.h
trunk/gladeui/glade-project.c
trunk/plugins/gtk+/glade-gtk.c
trunk/plugins/gtk+/gtk+.xml.in
Modified: trunk/gladeui/glade-editor-property.c
==============================================================================
--- trunk/gladeui/glade-editor-property.c (original)
+++ trunk/gladeui/glade-editor-property.c Wed Sep 17 18:21:55 2008
@@ -275,7 +275,7 @@
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;
}
Modified: trunk/gladeui/glade-editor.c
==============================================================================
--- trunk/gladeui/glade-editor.c (original)
+++ trunk/gladeui/glade-editor.c Wed Sep 17 18:21:55 2008
@@ -70,6 +70,22 @@
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 @@
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 @@
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);
}
}
Modified: trunk/gladeui/glade-editor.h
==============================================================================
--- trunk/gladeui/glade-editor.h (original)
+++ trunk/gladeui/glade-editor.h Wed Sep 17 18:21:55 2008
@@ -221,6 +221,10 @@
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
Modified: trunk/gladeui/glade-inspector.c
==============================================================================
--- trunk/gladeui/glade-inspector.c (original)
+++ trunk/gladeui/glade-inspector.c Wed Sep 17 18:21:55 2008
@@ -333,6 +333,7 @@
if (gwidget->parent == NULL)
toplevels = g_list_prepend (toplevels, object);
}
+ toplevels = g_list_reverse (toplevels);
/* recursively fill model */
fill_model (priv->model, toplevels, NULL);
Modified: trunk/gladeui/glade-palette-item.c
==============================================================================
--- trunk/gladeui/glade-palette-item.c (original)
+++ trunk/gladeui/glade-palette-item.c Wed Sep 17 18:21:55 2008
@@ -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 @@
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",
Modified: trunk/gladeui/glade-popup.c
==============================================================================
--- trunk/gladeui/glade-popup.c (original)
+++ trunk/gladeui/glade-popup.c Wed Sep 17 18:21:55 2008
@@ -95,11 +95,11 @@
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_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 @@
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);
}
@@ -579,6 +593,46 @@
}
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)
{
GtkWidget *popup_menu;
Modified: trunk/gladeui/glade-popup.h
==============================================================================
--- trunk/gladeui/glade-popup.h (original)
+++ trunk/gladeui/glade-popup.h Wed Sep 17 18:21:55 2008
@@ -14,13 +14,15 @@
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
Modified: trunk/gladeui/glade-project.c
==============================================================================
--- trunk/gladeui/glade-project.c (original)
+++ trunk/gladeui/glade-project.c Wed Sep 17 18:21:55 2008
@@ -1892,7 +1892,7 @@
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 @@
required = g_list_prepend (required, catalog);
}
}
- return required;
+ return g_list_reverse (required);
}
#define GLADE_XML_COMMENT "Generated with "PACKAGE_NAME
Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c (original)
+++ trunk/plugins/gtk+/glade-gtk.c Wed Sep 17 18:21:55 2008
@@ -2645,6 +2645,31 @@
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,
Modified: trunk/plugins/gtk+/gtk+.xml.in
==============================================================================
--- trunk/plugins/gtk+/gtk+.xml.in (original)
+++ trunk/plugins/gtk+/gtk+.xml.in Wed Sep 17 18:21:55 2008
@@ -1038,6 +1038,7 @@
<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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]