[gtk+/parasite2: 20/38] parasite: Use a template for window
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/parasite2: 20/38] parasite: Use a template for window
- Date: Thu, 8 May 2014 22:17:32 +0000 (UTC)
commit d0e33fbe5af8f1b5c268587ac0f5201aa0eaee6e
Author: Matthias Clasen <mclasen redhat com>
Date: Sun May 4 23:47:11 2014 -0400
parasite: Use a template for window
modules/other/parasite/Makefile.am | 8 +-
modules/other/parasite/classes-list.c | 1 -
modules/other/parasite/css-editor.c | 1 -
modules/other/parasite/inspect-button.c | 7 +-
modules/other/parasite/module.c | 5 +-
modules/other/parasite/object-hierarchy.c | 1 -
modules/other/parasite/parasite.gresource.xml | 1 +
modules/other/parasite/prop-list.c | 2 +-
modules/other/parasite/property-cell-renderer.c | 4 +-
modules/other/parasite/widget-tree.c | 2 +-
modules/other/parasite/window.c | 347 +++++++----------------
modules/other/parasite/{parasite.h => window.h} | 30 ++-
modules/other/parasite/window.ui | 239 ++++++++++++++++
13 files changed, 377 insertions(+), 271 deletions(-)
---
diff --git a/modules/other/parasite/Makefile.am b/modules/other/parasite/Makefile.am
index 2b023dd..f0e7b97 100644
--- a/modules/other/parasite/Makefile.am
+++ b/modules/other/parasite/Makefile.am
@@ -19,17 +19,17 @@ libgtkparasite_la_SOURCES = \
resources.c \
inspect-button.c \
module.c \
- parasite.h \
prop-list.h \
prop-list.c \
- property-cell-renderer.c \
property-cell-renderer.h \
- python-hooks.c \
+ property-cell-renderer.c \
python-hooks.h \
- python-shell.c \
+ python-hooks.c \
python-shell.h \
+ python-shell.c \
widget-tree.h \
widget-tree.c \
+ window.h \
window.c \
button-path.h \
button-path.c \
diff --git a/modules/other/parasite/classes-list.c b/modules/other/parasite/classes-list.c
index 570ee53..9912458 100644
--- a/modules/other/parasite/classes-list.c
+++ b/modules/other/parasite/classes-list.c
@@ -21,7 +21,6 @@
*/
#include "classes-list.h"
-#include "parasite.h"
enum
{
diff --git a/modules/other/parasite/css-editor.c b/modules/other/parasite/css-editor.c
index bc2f585..d8573fe 100644
--- a/modules/other/parasite/css-editor.c
+++ b/modules/other/parasite/css-editor.c
@@ -21,7 +21,6 @@
*/
#include "css-editor.h"
-#include "parasite.h"
#define PARASITE_CSS_EDITOR_TEXT "parasite-css-editor-text"
#define PARASITE_CSS_EDITOR_PROVIDER "parasite-css-editor-provider"
diff --git a/modules/other/parasite/inspect-button.c b/modules/other/parasite/inspect-button.c
index b148528..10b0cb6 100644
--- a/modules/other/parasite/inspect-button.c
+++ b/modules/other/parasite/inspect-button.c
@@ -20,7 +20,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "parasite.h"
+
+#include "window.h"
#include "widget-tree.h"
typedef struct
@@ -230,7 +231,7 @@ on_highlight_widget (GtkWidget *button,
return;
}
- if (gtk_widget_get_toplevel (widget) == parasite->window)
+ if (gtk_widget_get_toplevel (widget) == GTK_WIDGET (parasite))
{
/* Don't hilight things in the parasite window */
return;
@@ -266,7 +267,7 @@ property_query_event (GtkWidget *widget,
return FALSE;
}
-static void
+void
on_inspect (GtkWidget *button,
ParasiteWindow *parasite)
{
diff --git a/modules/other/parasite/module.c b/modules/other/parasite/module.c
index 4ef11e8..f54eada 100644
--- a/modules/other/parasite/module.c
+++ b/modules/other/parasite/module.c
@@ -22,8 +22,7 @@
*/
#include <glib.h>
-#include "config.h"
-#include "parasite.h"
+#include "window.h"
#include "python-hooks.h"
#include "resources.h"
@@ -37,7 +36,7 @@ gtk_module_init (gint *argc, gchar ***argv)
parasite_register_resource ();
- gtkparasite_window_create ();
+ gtk_window_present (GTK_WINDOW (parasite_window_new ()));
}
// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/object-hierarchy.c b/modules/other/parasite/object-hierarchy.c
index 921fc76..61f86f7 100644
--- a/modules/other/parasite/object-hierarchy.c
+++ b/modules/other/parasite/object-hierarchy.c
@@ -21,7 +21,6 @@
*/
#include "object-hierarchy.h"
-#include "parasite.h"
enum
{
diff --git a/modules/other/parasite/parasite.gresource.xml b/modules/other/parasite/parasite.gresource.xml
index e8300b6..9950c28 100644
--- a/modules/other/parasite/parasite.gresource.xml
+++ b/modules/other/parasite/parasite.gresource.xml
@@ -8,5 +8,6 @@
<file>widget-tree.ui</file>
<file>prop-list.ui</file>
<file>themes.ui</file>
+ <file>window.ui</file>
</gresource>
</gresources>
diff --git a/modules/other/parasite/prop-list.c b/modules/other/parasite/prop-list.c
index 16c41ed..e09cb72 100644
--- a/modules/other/parasite/prop-list.c
+++ b/modules/other/parasite/prop-list.c
@@ -20,7 +20,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "parasite.h"
+
#include "prop-list.h"
#include "property-cell-renderer.h"
diff --git a/modules/other/parasite/property-cell-renderer.c b/modules/other/parasite/property-cell-renderer.c
index 1e0f4e9..3e72e2a 100644
--- a/modules/other/parasite/property-cell-renderer.c
+++ b/modules/other/parasite/property-cell-renderer.c
@@ -20,7 +20,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "parasite.h"
+
#include "property-cell-renderer.h"
#include "widget-tree.h"
@@ -325,7 +325,7 @@ start_editing (GtkCellRenderer *renderer,
}
renderers = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(combobox));
- g_object_set(G_OBJECT(renderers->data), "scale", TREE_TEXT_SCALE, NULL);
+ g_object_set(G_OBJECT(renderers->data), "scale", 0.8, NULL);
g_list_free(renderers);
editable = GTK_CELL_EDITABLE(combobox);
diff --git a/modules/other/parasite/widget-tree.c b/modules/other/parasite/widget-tree.c
index 7a526e4..6730111 100644
--- a/modules/other/parasite/widget-tree.c
+++ b/modules/other/parasite/widget-tree.c
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#include "parasite.h"
+
#include "prop-list.h"
#include "widget-tree.h"
#include <string.h>
diff --git a/modules/other/parasite/window.c b/modules/other/parasite/window.c
index 00c131f..9fc8646 100644
--- a/modules/other/parasite/window.c
+++ b/modules/other/parasite/window.c
@@ -23,8 +23,9 @@
*/
#include <stdlib.h>
-#include "parasite.h"
+#include "window.h"
#include "prop-list.h"
+#include "property-cell-renderer.h"
#include "classes-list.h"
#include "css-editor.h"
#include "object-hierarchy.h"
@@ -34,58 +35,78 @@
#include "button-path.h"
#include "themes.h"
+G_DEFINE_TYPE (ParasiteWindow, parasite_window, GTK_TYPE_WINDOW)
+
+static void
+delete_window (GtkWidget *widget)
+{
+ GApplication *app = g_application_get_default ();
+
+ gtk_widget_hide (widget);
+
+ if (app)
+ g_application_quit (app);
+ else
+ exit (0);
+}
+
+extern void on_inspect (GtkWidget *button, ParasiteWindow *pw);
+
static void
-on_widget_tree_selection_changed (ParasiteWidgetTree *widget_tree,
- ParasiteWindow *parasite)
+on_graphic_updates_toggled (GtkToggleButton *button,
+ ParasiteWindow *parasite)
{
- GObject *selected = parasite_widget_tree_get_selected_object (widget_tree);
+ gdk_window_set_debug_updates (gtk_toggle_button_get_active (button));
+}
+
+static gboolean
+on_widget_tree_button_press (ParasiteWidgetTree *widget_tree,
+ GdkEventButton *event,
+ ParasiteWindow *parasite)
+{
+ if (event->button == 3)
+ gtk_menu_popup (GTK_MENU (parasite->widget_popup), NULL, NULL,
+ NULL, NULL, event->button, event->time);
+
+ return FALSE;
+}
+
+static void
+on_widget_tree_selection_changed (ParasiteWidgetTree *wt,
+ ParasiteWindow *pw)
+{
+ GObject *selected = parasite_widget_tree_get_selected_object (wt);
if (selected != NULL)
{
- if (!parasite_prop_list_set_object (PARASITE_PROP_LIST (parasite->prop_list), selected))
+ if (!parasite_prop_list_set_object (PARASITE_PROP_LIST (pw->prop_list), selected))
return;
- parasite_prop_list_set_object (PARASITE_PROP_LIST (parasite->child_prop_list), selected);
- parasite_object_hierarchy_set_object (PARASITE_OBJECT_HIERARCHY (parasite->oh), selected);
+ parasite_prop_list_set_object (PARASITE_PROP_LIST (pw->child_prop_list), selected);
+ parasite_object_hierarchy_set_object (PARASITE_OBJECT_HIERARCHY (pw->object_hierarchy), selected);
if (GTK_IS_WIDGET (selected))
{
GtkWidget *widget = GTK_WIDGET (selected);
- gtkparasite_flash_widget(parasite, widget);
- parasite_button_path_set_widget (PARASITE_BUTTON_PATH (parasite->button_path), widget);
- parasite_classes_list_set_widget (PARASITE_CLASSES_LIST (parasite->classes_list), widget);
- parasite_css_editor_set_widget (PARASITE_CSS_EDITOR (parasite->widget_css_editor), widget);
+ gtkparasite_flash_widget (pw, widget);
+ parasite_button_path_set_widget (PARASITE_BUTTON_PATH (pw->button_path), widget);
+ parasite_classes_list_set_widget (PARASITE_CLASSES_LIST (pw->classes_list), widget);
+ parasite_css_editor_set_widget (PARASITE_CSS_EDITOR (pw->widget_css_editor), widget);
}
else
{
- gtk_widget_set_sensitive (parasite->classes_list, FALSE);
- gtk_widget_set_sensitive (parasite->widget_css_editor, FALSE);
+ gtk_widget_set_sensitive (pw->classes_list, FALSE);
+ gtk_widget_set_sensitive (pw->widget_css_editor, FALSE);
}
}
}
-
-static gboolean
-on_widget_tree_button_press(ParasiteWidgetTree *widget_tree,
- GdkEventButton *event,
- ParasiteWindow *parasite)
-{
- if (event->button == 3)
- {
- gtk_menu_popup(GTK_MENU(parasite->widget_popup), NULL, NULL,
- NULL, NULL, event->button, event->time);
- }
-
- return FALSE;
-}
-
-
static void
-on_send_widget_to_shell_activate(GtkWidget *menuitem,
- ParasiteWindow *parasite)
+on_send_widget_to_shell_activate (GtkWidget *menuitem,
+ ParasiteWindow *parasite)
{
- char *str;
+ gchar *str;
GObject *object;
object = parasite_widget_tree_get_selected_object (PARASITE_WIDGET_TREE (parasite->widget_tree));
@@ -98,237 +119,69 @@ on_send_widget_to_shell_activate(GtkWidget *menuitem,
str,
NULL);
- g_free(str);
+ g_free (str);
parasite_python_shell_focus (PARASITE_PYTHON_SHELL (parasite->python_shell));
}
-
-static GtkWidget *
-create_widget_list_pane(ParasiteWindow *parasite)
+static void
+parasite_window_init (ParasiteWindow *pw)
{
- GtkWidget *swin;
+ gchar *title;
- swin = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
- "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
- "vscrollbar-policy", GTK_POLICY_ALWAYS,
- "shadow-type", GTK_SHADOW_IN,
- "width-request", 250,
- "expand", TRUE,
- NULL);
+ gtk_widget_init_template (GTK_WIDGET (pw));
- parasite->widget_tree = parasite_widget_tree_new();
- gtk_container_add(GTK_CONTAINER(swin), parasite->widget_tree);
+ gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (pw));
- g_signal_connect(G_OBJECT(parasite->widget_tree),
- "widget-changed",
- G_CALLBACK(on_widget_tree_selection_changed),
- parasite);
+ title = g_strconcat ("Parasite - ", g_get_application_name (), NULL);
+ gtk_window_set_title (GTK_WINDOW (pw), title);
+ g_free (title);
- if (parasite_python_is_enabled())
+ if (parasite_python_is_enabled ())
{
- g_signal_connect(G_OBJECT(parasite->widget_tree),
- "button-press-event",
- G_CALLBACK(on_widget_tree_button_press),
- parasite);
+ gtk_widget_show (pw->python_shell);
+ g_signal_connect (G_OBJECT (pw->widget_tree), "button-press-event",
+ G_CALLBACK (on_widget_tree_button_press), pw);
}
-
- return swin;
-}
-
-static GtkWidget *
-create_prop_list_pane (ParasiteWindow *parasite,
- gboolean child_properties)
-{
- GtkWidget *swin;
- GtkWidget *pl;
-
- swin = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
- "hscrollbar-policy", GTK_POLICY_AUTOMATIC,
- "vscrollbar-policy", GTK_POLICY_ALWAYS,
- "shadow-type", GTK_SHADOW_IN,
- "width-request", 250,
- NULL);
-
- pl = parasite_prop_list_new (parasite->widget_tree, child_properties);
- gtk_container_add (GTK_CONTAINER (swin), pl);
-
- if (child_properties)
- parasite->child_prop_list = pl;
- else
- parasite->prop_list = pl;
-
- return swin;
}
static void
-on_show_graphic_updates_toggled(GtkWidget *toggle_button,
- ParasiteWindow *parasite)
+parasite_window_class_init (ParasiteWindowClass *klass)
{
- gdk_window_set_debug_updates(
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
-}
-
-static GtkWidget *
-create_toolbar (ParasiteWindow *window) {
- GtkWidget *button;
- GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- GtkStyleContext *context = gtk_widget_get_style_context (box);
- GtkWidget *image;
-
- gtk_style_context_add_class (context, "linked");
-
- button = gtkparasite_inspect_button_new (window);
- gtk_container_add (GTK_CONTAINER (box), button);
-
- button = gtk_toggle_button_new ();
- image = gtk_image_new_from_icon_name ("view-refresh", GTK_ICON_SIZE_BUTTON);
- gtk_button_set_image (GTK_BUTTON (button), image);
- gtk_widget_set_tooltip_text (button, "Show Graphic Updates");
- gtk_container_add (GTK_CONTAINER (box), button);
- g_signal_connect (button,
- "toggled",
- G_CALLBACK (on_show_graphic_updates_toggled),
- window);
-
- gtk_widget_show_all (box);
- return box;
-}
-
-static void
-delete_window (GtkWidget *widget) {
- GApplication *app = g_application_get_default ();
-
- gtk_widget_hide (widget);
-
- if (app)
- g_application_quit (app);
- else
- exit (0);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/window.ui");
+
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, widget_tree);
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, prop_list);
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, child_prop_list);
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, button_path);
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, classes_list);
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, widget_css_editor);
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, object_hierarchy);
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, python_shell);
+ gtk_widget_class_bind_template_child (widget_class, ParasiteWindow, widget_popup);
+
+ gtk_widget_class_bind_template_callback (widget_class, delete_window);
+ gtk_widget_class_bind_template_callback (widget_class, on_inspect);
+ gtk_widget_class_bind_template_callback (widget_class, on_graphic_updates_toggled);
+ gtk_widget_class_bind_template_callback (widget_class, on_widget_tree_selection_changed);
+ gtk_widget_class_bind_template_callback (widget_class, on_send_widget_to_shell_activate);
}
-void
-gtkparasite_window_create()
+GtkWidget *
+parasite_window_new (void)
{
- ParasiteWindow *window;
- GtkWidget *vpaned, *hpaned;
- GtkWidget *header;
- GtkWidget *box;
- GtkWidget *nb;
- char *title;
- GtkWindowGroup *group;
-
- window = g_new0(ParasiteWindow, 1);
-
- /*
- * Create the top-level window.
- */
- window->window = g_object_new (GTK_TYPE_WINDOW,
- "default-height", 500,
- "default-width", 1000,
- NULL);
- g_signal_connect (window->window,
- "delete-event",
- G_CALLBACK (delete_window),
- NULL);
-
- group = gtk_window_group_new ();
- gtk_window_group_add_window (group, GTK_WINDOW (window->window));
-
- title = g_strdup_printf("Parasite - %s", g_get_application_name());
- gtk_window_set_title (GTK_WINDOW (window->window), title);
-
- header = gtk_header_bar_new ();
- gtk_header_bar_set_title (GTK_HEADER_BAR (header), title);
- gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
- gtk_window_set_titlebar (GTK_WINDOW (window->window), header);
- gtk_header_bar_pack_start (GTK_HEADER_BAR (header), create_toolbar (window));
-
- g_free(title);
-
- nb = g_object_new (GTK_TYPE_NOTEBOOK,
- "show-border", FALSE,
- "margin-left", 6,
- "margin-right", 6,
- "margin-bottom", 6,
- NULL);
- gtk_container_add (GTK_CONTAINER (window->window), nb);
-
- box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_notebook_append_page (GTK_NOTEBOOK (nb),
- box,
- gtk_label_new ("Widget Tree"));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (nb),
- parasite_themes_new (),
- gtk_label_new ("Themes"));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (nb),
- parasite_css_editor_new (TRUE),
- gtk_label_new ("Custom CSS"));
-
- window->button_path = parasite_button_path_new ();
- gtk_container_add (GTK_CONTAINER (box), window->button_path);
-
- hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_container_add (GTK_CONTAINER (box), hpaned);
-
- vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
- gtk_paned_pack1 (GTK_PANED (hpaned), vpaned, TRUE, TRUE);
- gtk_paned_pack1 (GTK_PANED (vpaned), create_widget_list_pane (window), TRUE, FALSE);
-
- nb = g_object_new (GTK_TYPE_NOTEBOOK,
- "enable-popup", TRUE,
- "show-border", FALSE,
- NULL);
- gtk_notebook_append_page (GTK_NOTEBOOK (nb),
- create_prop_list_pane (window, FALSE),
- gtk_label_new ("Properties"));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (nb),
- create_prop_list_pane (window, TRUE),
- gtk_label_new ("Child Properties"));
-
- window->oh = parasite_object_hierarchy_new ();
- gtk_notebook_append_page (GTK_NOTEBOOK (nb),
- window->oh,
- gtk_label_new ("Hierarchy"));
-
- window->classes_list = parasite_classes_list_new ();
- gtk_notebook_append_page (GTK_NOTEBOOK (nb),
- window->classes_list,
- gtk_label_new ("CSS Classes"));
-
- window->widget_css_editor = parasite_css_editor_new (FALSE);
- gtk_notebook_append_page (GTK_NOTEBOOK (nb),
- window->widget_css_editor,
- gtk_label_new ("Custom CSS"));
-
- gtk_paned_pack2 (GTK_PANED (hpaned), nb, TRUE, TRUE);
-
- if (parasite_python_is_enabled())
- {
- GtkWidget *menuitem;
-
- window->python_shell = parasite_python_shell_new();
- gtk_paned_pack2(GTK_PANED(vpaned), window->python_shell, FALSE, FALSE);
-
- /*
- * XXX Eventually we'll want to put more in here besides the menu
- * item we define below. At that point, we'll need to make this
- * more generic.
- */
- window->widget_popup = gtk_menu_new();
- gtk_widget_show(window->widget_popup);
-
- menuitem = gtk_menu_item_new_with_label("Send Widget to Shell");
- gtk_widget_show(menuitem);
- gtk_menu_shell_append(GTK_MENU_SHELL(window->widget_popup), menuitem);
-
- g_signal_connect(G_OBJECT(menuitem), "activate",
- G_CALLBACK(on_send_widget_to_shell_activate), window);
- }
-
- gtk_widget_show_all (window->window);
+ g_type_ensure (PARASITE_TYPE_THEMES);
+ g_type_ensure (PARASITE_TYPE_CSS_EDITOR);
+ g_type_ensure (PARASITE_TYPE_BUTTON_PATH);
+ g_type_ensure (PARASITE_TYPE_WIDGET_TREE);
+ g_type_ensure (PARASITE_TYPE_PROP_LIST);
+ g_type_ensure (PARASITE_TYPE_OBJECT_HIERARCHY);
+ g_type_ensure (PARASITE_TYPE_CLASSES_LIST);
+ g_type_ensure (PARASITE_TYPE_PYTHON_SHELL);
+ g_type_ensure (PARASITE_TYPE_PROPERTY_CELL_RENDERER);
+
+ return GTK_WIDGET (g_object_new (PARASITE_TYPE_WINDOW, NULL));
}
-// vim: set et sw=4 ts=4:
+// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/parasite.h b/modules/other/parasite/window.h
similarity index 66%
rename from modules/other/parasite/parasite.h
rename to modules/other/parasite/window.h
index 4add594..b79d8a7 100644
--- a/modules/other/parasite/parasite.h
+++ b/modules/other/parasite/window.h
@@ -20,20 +20,27 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-#ifndef _GTKPARASITE_H_
-#define _GTKPARASITE_H_
+#ifndef _PARASITE_WINDOW_H_
+#define _PARASITE_WINDOW_H_
#include <gtk/gtk.h>
+#define PARASITE_TYPE_WINDOW (parasite_window_get_type())
+#define PARASITE_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_WINDOW,
ParasiteWindow))
+#define PARASITE_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_WINDOW,
ParasiteWindowClass))
+#define PARASITE_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_WINDOW))
+#define PARASITE_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_WINDOW))
+#define PARASITE_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_WINDOW,
ParasiteWindowClass))
+
#define TREE_TEXT_SCALE 0.8
#define TREE_CHECKBOX_SIZE (gint)(0.8 * 13)
-
typedef struct
{
- GtkWidget *window;
+ GtkWindow parent;
+
GtkWidget *widget_tree;
GtkWidget *prop_list;
GtkWidget *child_prop_list;
@@ -41,7 +48,7 @@ typedef struct
GtkWidget *button_path;
GtkWidget *classes_list;
GtkWidget *widget_css_editor;
- GtkWidget *oh;
+ GtkWidget *object_hierarchy;
GtkWidget *widget_popup;
@@ -53,15 +60,24 @@ typedef struct
} ParasiteWindow;
+typedef struct
+{
+ GtkWindowClass parent;
+} ParasiteWindowClass;
+
+
+G_BEGIN_DECLS
-void gtkparasite_window_create (void);
+GType parasite_window_get_type (void);
+GtkWidget *parasite_window_new (void);
void gtkparasite_flash_widget (ParasiteWindow *parasite,
GtkWidget *widget);
GtkWidget *gtkparasite_inspect_button_new (ParasiteWindow *parasite);
+G_END_DECLS
-#endif // _GTKPARASITE_H_
+#endif // _PARASITE_WINDOW_H_
// vim: set et sw=2 ts=2:
diff --git a/modules/other/parasite/window.ui b/modules/other/parasite/window.ui
new file mode 100644
index 0000000..5de9238
--- /dev/null
+++ b/modules/other/parasite/window.ui
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <object class="GtkImage" id="update_image">
+ <property name="visible">True</property>
+ <property name="icon-name">view-refresh</property>
+ <property name="icon-size">4</property>
+ </object>
+ <object class="GtkImage" id="inspect_image">
+ <property name="visible">True</property>
+ <property name="icon-name">edit-find</property>
+ <property name="icon-size">4</property>
+ </object>
+ <object class="GtkMenu" id="widget_popup">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkMenuItem">
+ <property name="visible">True</property>
+ <property name="label">Send Widget to Shell</property>
+ <signal name="activate" handler="on_send_widget_to_shell_activate"/>
+ </object>
+ </child>
+ </object>
+ <template class="ParasiteWindow" parent="GtkWindow">
+ <property name="default-height">500</property>
+ <property name="default-width">1000</property>
+ <signal name="delete-event" handler="delete_window"/>
+ <child type="titlebar">
+ <object class="GtkHeaderBar">
+ <property name="visible">True</property>
+ <property name="show-close-button">True</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <style>
+ <class name="linked"/>
+ </style>
+ <child>
+ <object class="GtkButton">
+ <property name="visible">True</property>
+ <property name="image">inspect_image</property>
+ <property name="tooltip-text">Inspect</property>
+ <signal name="clicked" handler="on_inspect"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton">
+ <property name="visible">True</property>
+ <property name="image">update_image</property>
+ <property name="tooltip-text">Show Graphic Updates</property>
+ <signal name="toggled" handler="on_graphic_updates_toggled"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkNotebook">
+ <property name="visible">True</property>
+ <property name="show-border">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="ParasiteButtonPath" id="button_path">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkPaned">
+ <property name="visible">True</property>
+ <property name="orientation">horizontal</property>
+ <child>
+ <object class="GtkPaned">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="hscrollbar-policy">automatic</property>
+ <property name="vscrollbar-policy">always</property>
+ <property name="shadow-type">in</property>
+ <property name="width-request">250</property>
+ <property name="expand">True</property>
+ <child>
+ <object class="ParasiteWidgetTree" id="widget_tree">
+ <property name="visible">True</property>
+ <signal name="widget-changed" handler="on_widget_tree_selection_changed"/>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="ParasitePythonShell" id="python_shell">
+ <property name="visible">False</property>
+ </object>
+ <packing>
+ <property name="resize">False</property>
+ <property name="shrink">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkNotebook">
+ <property name="visible">True</property>
+ <property name="enable-popup">True</property>
+ <property name="show-border">False</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="hscrollbar-policy">automatic</property>
+ <property name="vscrollbar-policy">always</property>
+ <property name="shadow-type">in</property>
+ <property name="width-request">250</property>
+ <child>
+ <object class="ParasitePropList" id="prop_list">
+ <property name="visible">True</property>
+ <property name="child-properties">False</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label">Properties</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="hscrollbar-policy">automatic</property>
+ <property name="vscrollbar-policy">always</property>
+ <property name="shadow-type">in</property>
+ <property name="width-request">250</property>
+ <child>
+ <object class="ParasitePropList" id="child_prop_list">
+ <property name="visible">True</property>
+ <property name="child-properties">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label">Child Properties</property>
+ </object>
+ </child>
+ <child>
+ <object class="ParasiteObjectHierarchy" id="object_hierarchy">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label">Hierarchy</property>
+ </object>
+ </child>
+ <child>
+ <object class="ParasiteClassesList" id="classes_list">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label">CSS Classes</property>
+ </object>
+ </child>
+ <child>
+ <object class="ParasiteCssEditor" id="widget_css_editor">
+ <property name="visible">True</property>
+ <property name="global">False</property>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label">Custom CSS</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">True</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label">Widget Tree</property>
+ </object>
+ </child>
+ <child>
+ <object class="ParasiteThemes">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label">Themes</property>
+ </object>
+ </child>
+ <child>
+ <object class="ParasiteCssEditor">
+ <property name="visible">True</property>
+ <property name="global">True</property>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label">Custom CSS</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]