mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Rename parasite to gtkinspector
This avoids namespace collisions with the original gtkparasite project, and adds the gtk prefix to all symbols and type names.
This commit is contained in:
parent
19bf88acfa
commit
ccff3e952d
@ -12432,30 +12432,32 @@ static void
|
||||
gtk_window_toggle_debugging (GtkWindow *window)
|
||||
{
|
||||
static GType type = G_TYPE_NONE;
|
||||
static GtkWidget *parasite_window = NULL;
|
||||
static GtkWidget *inspector_window = NULL;
|
||||
|
||||
g_print ("toggle debugging\n");
|
||||
g_debug ("toggle debugging");
|
||||
|
||||
if (type == G_TYPE_NONE)
|
||||
{
|
||||
_gtk_modules_load_module ("gtkparasite");
|
||||
type = g_type_from_name ("ParasiteWindow");
|
||||
_gtk_modules_load_module ("gtkinspector");
|
||||
type = g_type_from_name ("GtkInspectorWindow");
|
||||
if (type == G_TYPE_INVALID)
|
||||
g_warning ("Failed to load gtkparasite module, debugging not available.");
|
||||
g_warning ("Failed to load GtkInspector module, debugging not available.");
|
||||
}
|
||||
|
||||
if (!g_type_is_a (type, GTK_TYPE_WINDOW))
|
||||
return;
|
||||
|
||||
if (parasite_window == NULL)
|
||||
if (inspector_window == NULL)
|
||||
{
|
||||
parasite_window = GTK_WIDGET (g_object_new (type, NULL));
|
||||
g_signal_connect (parasite_window, "delete-event",
|
||||
g_debug ("creating a GtkInspector window");
|
||||
|
||||
inspector_window = GTK_WIDGET (g_object_new (type, NULL));
|
||||
g_signal_connect (inspector_window, "delete-event",
|
||||
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
|
||||
}
|
||||
|
||||
if (gtk_widget_is_visible (parasite_window))
|
||||
gtk_widget_hide (parasite_window);
|
||||
if (gtk_widget_is_visible (inspector_window))
|
||||
gtk_widget_hide (inspector_window);
|
||||
else
|
||||
gtk_window_present (GTK_WINDOW (parasite_window));
|
||||
gtk_window_present (GTK_WINDOW (inspector_window));
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
moduledir = $(libdir)/gtk-3.0/modules
|
||||
|
||||
module_LTLIBRARIES = libgtkparasite.la
|
||||
module_LTLIBRARIES = libgtkinspector.la
|
||||
|
||||
resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/parasite.gresource.xml)
|
||||
resources.h: parasite.gresource.xml
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/parasite.gresource.xml \
|
||||
--target=$@ --sourcedir=$(srcdir) --c-name parasite --generate-header --manual-register
|
||||
resources.c: parasite.gresource.xml $(resource_files)
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/parasite.gresource.xml \
|
||||
--target=$@ --sourcedir=$(srcdir) --c-name parasite --generate-source --manual-register
|
||||
resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/inspector.gresource.xml)
|
||||
resources.h: inspector.gresource.xml
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
|
||||
--target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-header --manual-register
|
||||
resources.c: inspector.gresource.xml $(resource_files)
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/inspector.gresource.xml \
|
||||
--target=$@ --sourcedir=$(srcdir) --c-name gtk_inspector --generate-source --manual-register
|
||||
|
||||
BUILT_SOURCES = \
|
||||
resources.h \
|
||||
resources.c
|
||||
|
||||
libgtkparasite_la_SOURCES = \
|
||||
libgtkinspector_la_SOURCES = \
|
||||
resources.h \
|
||||
resources.c \
|
||||
inspect-button.c \
|
||||
@ -42,7 +42,7 @@ libgtkparasite_la_SOURCES = \
|
||||
themes.h \
|
||||
themes.c
|
||||
|
||||
libgtkparasite_la_CPPFLAGS = \
|
||||
libgtkinspector_la_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/gtk \
|
||||
-I$(top_builddir)/gtk \
|
||||
@ -57,9 +57,9 @@ if PLATFORM_WIN32
|
||||
no_undefined = -no-undefined
|
||||
endif
|
||||
|
||||
libgtkparasite_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
||||
libgtkinspector_la_LDFLAGS = -avoid-version -module $(no_undefined)
|
||||
|
||||
libgtkparasite_la_LIBADD = \
|
||||
libgtkinspector_la_LIBADD = \
|
||||
$(top_builddir)/gtk/libgtk-3.la \
|
||||
$(GTK_DEP_LIBS)
|
||||
|
||||
|
@ -22,40 +22,40 @@
|
||||
|
||||
#include "button-path.h"
|
||||
|
||||
struct _ParasiteButtonPathPrivate
|
||||
struct _GtkInspectorButtonPathPrivate
|
||||
{
|
||||
GtkWidget *sw;
|
||||
GtkWidget *button_box;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasiteButtonPath, parasite_button_path, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorButtonPath, gtk_inspector_button_path, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
parasite_button_path_init (ParasiteButtonPath *bp)
|
||||
gtk_inspector_button_path_init (GtkInspectorButtonPath *bp)
|
||||
{
|
||||
bp->priv = parasite_button_path_get_instance_private (bp);
|
||||
bp->priv = gtk_inspector_button_path_get_instance_private (bp);
|
||||
gtk_widget_init_template (GTK_WIDGET (bp));
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_button_path_class_init (ParasiteButtonPathClass *klass)
|
||||
gtk_inspector_button_path_class_init (GtkInspectorButtonPathClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/button-path.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteButtonPath, sw);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteButtonPath, button_box);
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/button-path.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorButtonPath, sw);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorButtonPath, button_box);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_button_path_new (void)
|
||||
gtk_inspector_button_path_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (PARASITE_TYPE_BUTTON_PATH, NULL));
|
||||
return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_BUTTON_PATH, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
parasite_button_path_set_widget (ParasiteButtonPath *bp,
|
||||
GtkWidget *widget)
|
||||
gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gchar *path, **words;
|
||||
gint i;
|
||||
|
@ -19,44 +19,44 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _GTKPARASITE_BUTTON_PATH_H_
|
||||
#define _GTKPARASITE_BUTTON_PATH_H_
|
||||
#ifndef _GTK_INSPECTOR_BUTTON_PATH_H_
|
||||
#define _GTK_INSPECTOR_BUTTON_PATH_H_
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PARASITE_TYPE_BUTTON_PATH (parasite_button_path_get_type())
|
||||
#define PARASITE_BUTTON_PATH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_BUTTON_PATH, ParasiteButtonPath))
|
||||
#define PARASITE_BUTTON_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_BUTTON_PATH, ParasiteButtonPathClass))
|
||||
#define PARASITE_IS_BUTTON_PATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_BUTTON_PATH))
|
||||
#define PARASITE_IS_BUTTON_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_BUTTON_PATH))
|
||||
#define PARASITE_BUTTON_PATH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_BUTTON_PATH, ParasiteButtonPathClass))
|
||||
#define GTK_TYPE_INSPECTOR_BUTTON_PATH (gtk_inspector_button_path_get_type())
|
||||
#define GTK_INSPECTOR_BUTTON_PATH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPath))
|
||||
#define GTK_INSPECTOR_BUTTON_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPathClass))
|
||||
#define GTK_INSPECTOR_IS_BUTTON_PATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH))
|
||||
#define GTK_INSPECTOR_IS_BUTTON_PATH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_BUTTON_PATH))
|
||||
#define GTK_INSPECTOR_BUTTON_PATH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_BUTTON_PATH, GtkInspectorButtonPathClass))
|
||||
|
||||
|
||||
typedef struct _ParasiteButtonPathPrivate ParasiteButtonPathPrivate;
|
||||
typedef struct _GtkInspectorButtonPathPrivate GtkInspectorButtonPathPrivate;
|
||||
|
||||
typedef struct _ParasiteButtonPath
|
||||
typedef struct _GtkInspectorButtonPath
|
||||
{
|
||||
GtkBox parent;
|
||||
ParasiteButtonPathPrivate *priv;
|
||||
} ParasiteButtonPath;
|
||||
GtkInspectorButtonPathPrivate *priv;
|
||||
} GtkInspectorButtonPath;
|
||||
|
||||
typedef struct _ParasiteButtonPathClass
|
||||
typedef struct _GtkInspectorButtonPathClass
|
||||
{
|
||||
GtkBoxClass parent;
|
||||
} ParasiteButtonPathClass;
|
||||
} GtkInspectorButtonPathClass;
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType parasite_button_path_get_type (void);
|
||||
GtkWidget *parasite_button_path_new (void);
|
||||
void parasite_button_path_set_widget (ParasiteButtonPath *bp,
|
||||
GtkWidget *widget);
|
||||
GType gtk_inspector_button_path_get_type (void);
|
||||
GtkWidget *gtk_inspector_button_path_new (void);
|
||||
void gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp,
|
||||
GtkWidget *widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
#endif // _GTKPARASITE_BUTTON_PATH_H_
|
||||
#endif // _GTK_INSPECTOR_BUTTON_PATH_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="ParasiteButtonPath" parent="GtkBox">
|
||||
<template class="GtkInspectorButtonPath" parent="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sw">
|
||||
|
@ -33,9 +33,9 @@ typedef struct
|
||||
{
|
||||
gboolean enabled;
|
||||
PangoStyle style;
|
||||
} ParasiteClassesListByContext;
|
||||
} GtkInspectorClassesListByContext;
|
||||
|
||||
struct _ParasiteClassesListPrivate
|
||||
struct _GtkInspectorClassesListPrivate
|
||||
{
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *view;
|
||||
@ -46,22 +46,22 @@ struct _ParasiteClassesListPrivate
|
||||
GtkStyleContext *current_context;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasiteClassesList, parasite_classes_list, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorClassesList, gtk_inspector_classes_list, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
enabled_toggled (GtkCellRendererToggle *renderer,
|
||||
const gchar *path,
|
||||
ParasiteClassesList *cl)
|
||||
enabled_toggled (GtkCellRendererToggle *renderer,
|
||||
const gchar *path,
|
||||
GtkInspectorClassesList *cl)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean enabled;
|
||||
GHashTable *context;
|
||||
ParasiteClassesListByContext *c;
|
||||
GtkInspectorClassesListByContext *c;
|
||||
gchar *name;
|
||||
|
||||
if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (cl->priv->model), &iter, path))
|
||||
{
|
||||
g_warning ("Parasite: Couldn't find the css class path for %s.", path);
|
||||
g_warning ("GtkInspector: Couldn't find the css class path for %s.", path);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -87,15 +87,15 @@ enabled_toggled (GtkCellRendererToggle *renderer,
|
||||
gtk_style_context_remove_class (cl->priv->current_context, name);
|
||||
}
|
||||
else
|
||||
g_warning ("Parasite: Couldn't find the css class %s in the class hash table.", name);
|
||||
g_warning ("GtkInspector: Couldn't find the css class %s in the class hash table.", name);
|
||||
}
|
||||
else
|
||||
g_warning ("Parasite: Couldn't find the hash table for the style context for css class %s.", name);
|
||||
g_warning ("GtkInspector: Couldn't find the hash table for the style context for css class %s.", name);
|
||||
}
|
||||
|
||||
static void
|
||||
add_clicked (GtkButton *button,
|
||||
ParasiteClassesList *cl)
|
||||
add_clicked (GtkButton *button,
|
||||
GtkInspectorClassesList *cl)
|
||||
{
|
||||
GtkWidget *dialog, *content_area, *entry;
|
||||
|
||||
@ -127,7 +127,7 @@ add_clicked (GtkButton *button,
|
||||
|
||||
gtk_style_context_add_class (cl->priv->current_context, name);
|
||||
|
||||
ParasiteClassesListByContext *c = g_new0 (ParasiteClassesListByContext, 1);
|
||||
GtkInspectorClassesListByContext *c = g_new0 (GtkInspectorClassesListByContext, 1);
|
||||
c->enabled = TRUE;
|
||||
c->style = PANGO_STYLE_ITALIC;
|
||||
g_hash_table_insert (context, (gpointer)g_strdup (name), c);
|
||||
@ -145,10 +145,10 @@ add_clicked (GtkButton *button,
|
||||
}
|
||||
|
||||
static void
|
||||
read_classes_from_style_context (ParasiteClassesList *cl)
|
||||
read_classes_from_style_context (GtkInspectorClassesList *cl)
|
||||
{
|
||||
GList *l, *classes;
|
||||
ParasiteClassesListByContext *c;
|
||||
GtkInspectorClassesListByContext *c;
|
||||
GtkTreeIter tree_iter;
|
||||
GHashTable *hash_context;
|
||||
|
||||
@ -157,7 +157,7 @@ read_classes_from_style_context (ParasiteClassesList *cl)
|
||||
|
||||
for (l = classes; l; l = l->next)
|
||||
{
|
||||
c = g_new0 (ParasiteClassesListByContext, 1);
|
||||
c = g_new0 (GtkInspectorClassesListByContext, 1);
|
||||
c->enabled = TRUE;
|
||||
g_hash_table_insert (hash_context, g_strdup (l->data), c);
|
||||
|
||||
@ -174,11 +174,11 @@ read_classes_from_style_context (ParasiteClassesList *cl)
|
||||
|
||||
static void
|
||||
restore_defaults_clicked (GtkButton *button,
|
||||
ParasiteClassesList *cl)
|
||||
GtkInspectorClassesList *cl)
|
||||
{
|
||||
GHashTableIter hash_iter;
|
||||
gchar *name;
|
||||
ParasiteClassesListByContext *c;
|
||||
GtkInspectorClassesListByContext *c;
|
||||
GHashTable *hash_context = g_hash_table_lookup (cl->priv->contexts, cl->priv->current_context);
|
||||
|
||||
g_hash_table_iter_init (&hash_iter, hash_context);
|
||||
@ -195,21 +195,21 @@ restore_defaults_clicked (GtkButton *button,
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_classes_list_init (ParasiteClassesList *cl)
|
||||
gtk_inspector_classes_list_init (GtkInspectorClassesList *cl)
|
||||
{
|
||||
cl->priv = parasite_classes_list_get_instance_private (cl);
|
||||
cl->priv = gtk_inspector_classes_list_get_instance_private (cl);
|
||||
gtk_widget_init_template (GTK_WIDGET (cl));
|
||||
cl->priv->contexts = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)g_hash_table_destroy);
|
||||
}
|
||||
|
||||
void
|
||||
parasite_classes_list_set_widget (ParasiteClassesList *cl,
|
||||
GtkWidget *widget)
|
||||
gtk_inspector_classes_list_set_widget (GtkInspectorClassesList *cl,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkStyleContext *widget_context;
|
||||
GHashTable *hash_context;
|
||||
GtkTreeIter tree_iter;
|
||||
ParasiteClassesListByContext *c;
|
||||
GtkInspectorClassesListByContext *c;
|
||||
|
||||
gtk_list_store_clear (cl->priv->model);
|
||||
|
||||
@ -243,25 +243,25 @@ parasite_classes_list_set_widget (ParasiteClassesList *cl,
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_classes_list_class_init (ParasiteClassesListClass *klass)
|
||||
gtk_inspector_classes_list_class_init (GtkInspectorClassesListClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/classes-list.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteClassesList, toolbar);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteClassesList, view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteClassesList, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteClassesList, column);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteClassesList, name_renderer);
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/classes-list.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, toolbar);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, column);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, name_renderer);
|
||||
gtk_widget_class_bind_template_callback (widget_class, add_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, restore_defaults_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, enabled_toggled);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_classes_list_new (void)
|
||||
gtk_inspector_classes_list_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (PARASITE_TYPE_CLASSES_LIST, NULL));
|
||||
return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_CLASSES_LIST, NULL));
|
||||
}
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -20,41 +20,41 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _GTKPARASITE_CLASSES_LIST_H_
|
||||
#define _GTKPARASITE_CLASSES_LIST_H_
|
||||
#ifndef _GTK_INSPECTOR_CLASSES_LIST_H_
|
||||
#define _GTK_INSPECTOR_CLASSES_LIST_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PARASITE_TYPE_CLASSES_LIST (parasite_classes_list_get_type())
|
||||
#define PARASITE_CLASSES_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_CLASSES_LIST, ParasiteClassesList))
|
||||
#define PARASITE_CLASSES_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_CLASSES_LIST, ParasiteClassesListClass))
|
||||
#define PARASITE_IS_CLASSES_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_CLASSES_LIST))
|
||||
#define PARASITE_IS_CLASSES_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_CLASSES_LIST))
|
||||
#define PARASITE_CLASSES_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_CLASSES_LIST, ParasiteClassesListClass))
|
||||
#define GTK_TYPE_INSPECTOR_CLASSES_LIST (gtk_inspector_classes_list_get_type())
|
||||
#define GTK_INSPECTOR_CLASSES_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesList))
|
||||
#define GTK_INSPECTOR_CLASSES_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesListClass))
|
||||
#define GTK_INSPECTOR_IS_CLASSES_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST))
|
||||
#define GTK_INSPECTOR_IS_CLASSES_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_CLASSES_LIST))
|
||||
#define GTK_INSPECTOR_CLASSES_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_CLASSES_LIST, GtkInspectorClassesListClass))
|
||||
|
||||
|
||||
typedef struct _ParasiteClassesListPrivate ParasiteClassesListPrivate;
|
||||
typedef struct _GtkInspectorClassesListPrivate GtkInspectorClassesListPrivate;
|
||||
|
||||
typedef struct _ParasiteClassesList
|
||||
typedef struct _GtkInspectorClassesList
|
||||
{
|
||||
GtkBox parent;
|
||||
ParasiteClassesListPrivate *priv;
|
||||
} ParasiteClassesList;
|
||||
GtkInspectorClassesListPrivate *priv;
|
||||
} GtkInspectorClassesList;
|
||||
|
||||
typedef struct _ParasiteClassesListClass
|
||||
typedef struct _GtkInspectorClassesListClass
|
||||
{
|
||||
GtkBoxClass parent;
|
||||
} ParasiteClassesListClass;
|
||||
} GtkInspectorClassesListClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType parasite_classes_list_get_type (void);
|
||||
GtkWidget *parasite_classes_list_new (void);
|
||||
void parasite_classes_list_set_widget (ParasiteClassesList *cl,
|
||||
GtkWidget *widget);
|
||||
GType gtk_inspector_classes_list_get_type (void);
|
||||
GtkWidget *gtk_inspector_classes_list_new (void);
|
||||
void gtk_inspector_classes_list_set_widget (GtkInspectorClassesList *cl,
|
||||
GtkWidget *widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _GTKPARASITE_CLASSES_LIST_H_
|
||||
#endif // _GTK_INSPECTOR_CLASSES_LIST_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -7,7 +7,7 @@
|
||||
<column type="PangoStyle"/>
|
||||
</columns>
|
||||
</object>
|
||||
<template class="ParasiteClassesList" parent="GtkBox">
|
||||
<template class="GtkInspectorClassesList" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
#include "css-editor.h"
|
||||
|
||||
#define PARASITE_CSS_EDITOR_TEXT "parasite-css-editor-text"
|
||||
#define PARASITE_CSS_EDITOR_PROVIDER "parasite-css-editor-provider"
|
||||
#define GTK_INSPECTOR_CSS_EDITOR_TEXT "inspector-css-editor-text"
|
||||
#define GTK_INSPECTOR_CSS_EDITOR_PROVIDER "inspector-css-editor-provider"
|
||||
|
||||
enum
|
||||
{
|
||||
@ -42,9 +42,9 @@ typedef struct
|
||||
{
|
||||
gboolean enabled;
|
||||
gboolean user;
|
||||
} ParasiteCssEditorByContext;
|
||||
} GtkInspectorCssEditorByContext;
|
||||
|
||||
struct _ParasiteCssEditorPrivate
|
||||
struct _GtkInspectorCssEditorPrivate
|
||||
{
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *view;
|
||||
@ -55,10 +55,10 @@ struct _ParasiteCssEditorPrivate
|
||||
GtkToggleToolButton *disable_button;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasiteCssEditor, parasite_css_editor, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorCssEditor, gtk_inspector_css_editor, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
set_initial_text (ParasiteCssEditor *editor)
|
||||
set_initial_text (GtkInspectorCssEditor *editor)
|
||||
{
|
||||
const gchar *initial_text_global =
|
||||
"/*\n"
|
||||
@ -75,7 +75,7 @@ set_initial_text (ParasiteCssEditor *editor)
|
||||
const gchar *text = NULL;
|
||||
|
||||
if (editor->priv->selected_context)
|
||||
text = g_object_get_data (G_OBJECT (editor->priv->selected_context), PARASITE_CSS_EDITOR_TEXT);
|
||||
text = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_TEXT);
|
||||
if (text)
|
||||
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (editor->priv->text), text, -1);
|
||||
else if (editor->priv->global)
|
||||
@ -85,8 +85,8 @@ set_initial_text (ParasiteCssEditor *editor)
|
||||
}
|
||||
|
||||
static void
|
||||
disable_toggled (GtkToggleToolButton *button,
|
||||
ParasiteCssEditor *editor)
|
||||
disable_toggled (GtkToggleToolButton *button,
|
||||
GtkInspectorCssEditor *editor)
|
||||
{
|
||||
if (gtk_toggle_tool_button_get_active (button))
|
||||
{
|
||||
@ -95,7 +95,7 @@ disable_toggled (GtkToggleToolButton *button,
|
||||
GTK_STYLE_PROVIDER (editor->priv->provider));
|
||||
else if (editor->priv->selected_context)
|
||||
gtk_style_context_remove_provider (editor->priv->selected_context,
|
||||
GTK_STYLE_PROVIDER (g_object_get_data (G_OBJECT (editor->priv->selected_context), PARASITE_CSS_EDITOR_PROVIDER)));
|
||||
GTK_STYLE_PROVIDER (g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -105,13 +105,13 @@ disable_toggled (GtkToggleToolButton *button,
|
||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||
else if (editor->priv->selected_context)
|
||||
gtk_style_context_add_provider (editor->priv->selected_context,
|
||||
GTK_STYLE_PROVIDER (g_object_get_data (G_OBJECT (editor->priv->selected_context), PARASITE_CSS_EDITOR_PROVIDER)),
|
||||
GTK_STYLE_PROVIDER (g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER)),
|
||||
G_MAXUINT);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
apply_system_font (ParasiteCssEditor *editor)
|
||||
apply_system_font (GtkInspectorCssEditor *editor)
|
||||
{
|
||||
GSettings *s = g_settings_new ("org.gnome.desktop.interface");
|
||||
gchar *font_name = g_settings_get_string (s, "monospace-font-name");
|
||||
@ -137,8 +137,8 @@ get_current_text (GtkTextBuffer *buffer)
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
ParasiteCssEditor *editor)
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
GtkInspectorCssEditor *editor)
|
||||
{
|
||||
GtkCssProvider *provider;
|
||||
gchar *text;
|
||||
@ -146,7 +146,7 @@ text_changed (GtkTextBuffer *buffer,
|
||||
if (editor->priv->global)
|
||||
provider = editor->priv->provider;
|
||||
else if (editor->priv->selected_context)
|
||||
provider = g_object_get_data (G_OBJECT (editor->priv->selected_context), PARASITE_CSS_EDITOR_PROVIDER);
|
||||
provider = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER);
|
||||
else
|
||||
return;
|
||||
|
||||
@ -158,10 +158,10 @@ text_changed (GtkTextBuffer *buffer,
|
||||
}
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
const GError *error,
|
||||
ParasiteCssEditor *editor)
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
const GError *error,
|
||||
GtkInspectorCssEditor *editor)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
const char *tag_name;
|
||||
@ -185,7 +185,7 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
}
|
||||
|
||||
static void
|
||||
create_provider (ParasiteCssEditor *editor)
|
||||
create_provider (GtkInspectorCssEditor *editor)
|
||||
{
|
||||
GtkCssProvider *provider = gtk_css_provider_new ();
|
||||
|
||||
@ -202,7 +202,7 @@ create_provider (ParasiteCssEditor *editor)
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
G_MAXUINT);
|
||||
g_object_set_data (G_OBJECT (editor->priv->selected_context),
|
||||
PARASITE_CSS_EDITOR_PROVIDER, provider);
|
||||
GTK_INSPECTOR_CSS_EDITOR_PROVIDER, provider);
|
||||
}
|
||||
|
||||
g_signal_connect (provider, "parsing-error",
|
||||
@ -210,16 +210,16 @@ create_provider (ParasiteCssEditor *editor)
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_css_editor_init (ParasiteCssEditor *editor)
|
||||
gtk_inspector_css_editor_init (GtkInspectorCssEditor *editor)
|
||||
{
|
||||
editor->priv = parasite_css_editor_get_instance_private (editor);
|
||||
editor->priv = gtk_inspector_css_editor_get_instance_private (editor);
|
||||
gtk_widget_init_template (GTK_WIDGET (editor));
|
||||
}
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
ParasiteCssEditor *editor = PARASITE_CSS_EDITOR (object);
|
||||
GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), editor->priv->global);
|
||||
create_provider (editor);
|
||||
@ -229,11 +229,11 @@ constructed (GObject *object)
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint param_id,
|
||||
guint param_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ParasiteCssEditor *editor = PARASITE_CSS_EDITOR (object);
|
||||
GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
@ -249,11 +249,11 @@ get_property (GObject *object,
|
||||
|
||||
static void
|
||||
set_property (GObject *object,
|
||||
guint param_id,
|
||||
guint param_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ParasiteCssEditor *editor = PARASITE_CSS_EDITOR (object);
|
||||
GtkInspectorCssEditor *editor = GTK_INSPECTOR_CSS_EDITOR (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
@ -268,7 +268,7 @@ set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_css_editor_class_init (ParasiteCssEditorClass *klass)
|
||||
gtk_inspector_css_editor_class_init (GtkInspectorCssEditorClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
@ -281,31 +281,31 @@ parasite_css_editor_class_init (ParasiteCssEditorClass *klass)
|
||||
g_param_spec_boolean ("global", "Global", "Whether this editor changes the whole application or just the selected widget",
|
||||
TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/css-editor.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteCssEditor, toolbar);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteCssEditor, text);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteCssEditor, view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteCssEditor, disable_button);
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/css-editor.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, toolbar);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, text);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, disable_button);
|
||||
gtk_widget_class_bind_template_callback (widget_class, disable_toggled);
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_changed);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_css_editor_new (gboolean global)
|
||||
gtk_inspector_css_editor_new (gboolean global)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (PARASITE_TYPE_CSS_EDITOR,
|
||||
return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_CSS_EDITOR,
|
||||
"global", global,
|
||||
NULL));
|
||||
}
|
||||
|
||||
void
|
||||
parasite_css_editor_set_widget (ParasiteCssEditor *editor,
|
||||
GtkWidget *widget)
|
||||
gtk_inspector_css_editor_set_widget (GtkInspectorCssEditor *editor,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gchar *text;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
g_return_if_fail (PARASITE_IS_CSS_EDITOR (editor));
|
||||
g_return_if_fail (GTK_INSPECTOR_IS_CSS_EDITOR (editor));
|
||||
g_return_if_fail (!editor->priv->global);
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (editor), TRUE);
|
||||
@ -314,14 +314,14 @@ parasite_css_editor_set_widget (ParasiteCssEditor *editor,
|
||||
{
|
||||
text = get_current_text (GTK_TEXT_BUFFER (editor->priv->text));
|
||||
g_object_set_data_full (G_OBJECT (editor->priv->selected_context),
|
||||
PARASITE_CSS_EDITOR_TEXT,
|
||||
GTK_INSPECTOR_CSS_EDITOR_TEXT,
|
||||
text,
|
||||
g_free);
|
||||
}
|
||||
|
||||
editor->priv->selected_context = gtk_widget_get_style_context (widget);
|
||||
|
||||
provider = g_object_get_data (G_OBJECT (editor->priv->selected_context), PARASITE_CSS_EDITOR_PROVIDER);
|
||||
provider = g_object_get_data (G_OBJECT (editor->priv->selected_context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER);
|
||||
if (!provider)
|
||||
create_provider (editor);
|
||||
|
||||
|
@ -20,41 +20,41 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _GTKPARASITE_CSS_EDITOR_H_
|
||||
#define _GTKPARASITE_CSS_EDITOR_H_
|
||||
#ifndef _GTK_INSPECTOR_CSS_EDITOR_H_
|
||||
#define _GTK_INSPECTOR_CSS_EDITOR_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PARASITE_TYPE_CSS_EDITOR (parasite_css_editor_get_type())
|
||||
#define PARASITE_CSS_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_CSS_EDITOR, ParasiteCssEditor))
|
||||
#define PARASITE_CSS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_CSS_EDITOR, ParasiteCssEditorClass))
|
||||
#define PARASITE_IS_CSS_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_CSS_EDITOR))
|
||||
#define PARASITE_IS_CSS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_CSS_EDITOR))
|
||||
#define PARASITE_CSS_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_CSS_EDITOR, ParasiteCssEditorClass))
|
||||
#define GTK_TYPE_INSPECTOR_CSS_EDITOR (gtk_inspector_css_editor_get_type())
|
||||
#define GTK_INSPECTOR_CSS_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditor))
|
||||
#define GTK_INSPECTOR_CSS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditorClass))
|
||||
#define GTK_INSPECTOR_IS_CSS_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR))
|
||||
#define GTK_INSPECTOR_IS_CSS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_CSS_EDITOR))
|
||||
#define GTK_INSPECTOR_CSS_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_CSS_EDITOR, GtkInspectorCssEditorClass))
|
||||
|
||||
|
||||
typedef struct _ParasiteCssEditorPrivate ParasiteCssEditorPrivate;
|
||||
typedef struct _GtkInspectorCssEditorPrivate GtkInspectorCssEditorPrivate;
|
||||
|
||||
typedef struct _ParasiteCssEditor
|
||||
typedef struct _GtkInspectorCssEditor
|
||||
{
|
||||
GtkBox parent;
|
||||
ParasiteCssEditorPrivate *priv;
|
||||
} ParasiteCssEditor;
|
||||
GtkInspectorCssEditorPrivate *priv;
|
||||
} GtkInspectorCssEditor;
|
||||
|
||||
typedef struct _ParasiteCssEditorClass
|
||||
typedef struct _GtkInspectorCssEditorClass
|
||||
{
|
||||
GtkBoxClass parent;
|
||||
} ParasiteCssEditorClass;
|
||||
} GtkInspectorCssEditorClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType parasite_css_editor_get_type (void);
|
||||
GtkWidget *parasite_css_editor_new (gboolean global);
|
||||
void parasite_css_editor_set_widget (ParasiteCssEditor *editor,
|
||||
GtkWidget *widget);
|
||||
GType gtk_inspector_css_editor_get_type (void);
|
||||
GtkWidget *gtk_inspector_css_editor_new (gboolean global);
|
||||
void gtk_inspector_css_editor_set_widget (GtkInspectorCssEditor *editor,
|
||||
GtkWidget *widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _GTKPARASITE_CSS_EDITOR_H_
|
||||
#endif // _GTK_INSPECTOR_CSS_EDITOR_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -16,7 +16,7 @@
|
||||
<property name="tag-table">tags</property>
|
||||
<signal name="changed" handler="text_changed"/>
|
||||
</object>
|
||||
<template class="ParasiteCssEditor" parent="GtkBox">
|
||||
<template class="GtkInspectorCssEditor" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
|
@ -168,58 +168,58 @@ find_widget_at_pointer (GdkDevice *device)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean draw_flash (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
ParasiteWindow *parasite);
|
||||
static gboolean draw_flash (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
GtkInspectorWindow *iw);
|
||||
|
||||
static void
|
||||
clear_flash (ParasiteWindow *parasite)
|
||||
clear_flash (GtkInspectorWindow *iw)
|
||||
{
|
||||
if (parasite->flash_widget)
|
||||
if (iw->flash_widget)
|
||||
{
|
||||
gtk_widget_queue_draw (parasite->flash_widget);
|
||||
g_signal_handlers_disconnect_by_func (parasite->flash_widget, draw_flash, parasite);
|
||||
parasite->flash_widget = NULL;
|
||||
gtk_widget_queue_draw (iw->flash_widget);
|
||||
g_signal_handlers_disconnect_by_func (iw->flash_widget, draw_flash, iw);
|
||||
iw->flash_widget = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
start_flash (ParasiteWindow *parasite,
|
||||
GtkWidget *widget)
|
||||
start_flash (GtkInspectorWindow *iw,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
parasite->flash_count = 1;
|
||||
parasite->flash_widget = widget;
|
||||
g_signal_connect_after (widget, "draw", G_CALLBACK (draw_flash), parasite);
|
||||
iw->flash_count = 1;
|
||||
iw->flash_widget = widget;
|
||||
g_signal_connect_after (widget, "draw", G_CALLBACK (draw_flash), iw);
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
on_inspect_widget (GtkWidget *button,
|
||||
GdkEvent *event,
|
||||
ParasiteWindow *parasite)
|
||||
on_inspect_widget (GtkWidget *button,
|
||||
GdkEvent *event,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
clear_flash (parasite);
|
||||
clear_flash (iw);
|
||||
|
||||
widget = find_widget_at_pointer (gdk_event_get_device (event));
|
||||
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
parasite->selected_widget = widget;
|
||||
iw->selected_widget = widget;
|
||||
|
||||
parasite_widget_tree_scan (PARASITE_WIDGET_TREE (parasite->widget_tree),
|
||||
gtk_widget_get_toplevel (widget));
|
||||
gtk_inspector_widget_tree_scan (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree),
|
||||
gtk_widget_get_toplevel (widget));
|
||||
|
||||
parasite_widget_tree_select_object (PARASITE_WIDGET_TREE (parasite->widget_tree),
|
||||
G_OBJECT (widget));
|
||||
gtk_inspector_widget_tree_select_object (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree),
|
||||
G_OBJECT (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
on_highlight_widget (GtkWidget *button,
|
||||
GdkEvent *event,
|
||||
ParasiteWindow *parasite)
|
||||
on_highlight_widget (GtkWidget *button,
|
||||
GdkEvent *event,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
@ -231,20 +231,20 @@ on_highlight_widget (GtkWidget *button,
|
||||
return;
|
||||
}
|
||||
|
||||
if (gtk_widget_get_toplevel (widget) == GTK_WIDGET (parasite))
|
||||
if (gtk_widget_get_toplevel (widget) == GTK_WIDGET (iw))
|
||||
{
|
||||
/* Don't hilight things in the parasite window */
|
||||
/* Don't hilight things in the inspector window */
|
||||
return;
|
||||
}
|
||||
|
||||
if (parasite->flash_widget == widget)
|
||||
if (iw->flash_widget == widget)
|
||||
{
|
||||
/* Already selected */
|
||||
return;
|
||||
}
|
||||
|
||||
clear_flash (parasite);
|
||||
start_flash (parasite, widget);
|
||||
clear_flash (iw);
|
||||
start_flash (iw, widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -268,15 +268,15 @@ property_query_event (GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
on_inspect (GtkWidget *button,
|
||||
ParasiteWindow *parasite)
|
||||
on_inspect (GtkWidget *button,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkDevice *device;
|
||||
GdkCursor *cursor;
|
||||
|
||||
g_signal_connect (button, "event",
|
||||
G_CALLBACK (property_query_event), parasite);
|
||||
G_CALLBACK (property_query_event), iw);
|
||||
|
||||
display = gtk_widget_get_display (button);
|
||||
cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
|
||||
@ -291,25 +291,25 @@ on_inspect (GtkWidget *button,
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtkparasite_inspect_button_new (ParasiteWindow *parasite)
|
||||
gtk_inspector_inspect_button_new (GtkInspectorWindow *iw)
|
||||
{
|
||||
GtkWidget *button;
|
||||
|
||||
button = gtk_button_new_from_icon_name ("edit-find", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_widget_set_tooltip_text (button, "Inspect");
|
||||
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_inspect), parasite);
|
||||
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (on_inspect), iw);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
draw_flash (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
ParasiteWindow *parasite)
|
||||
draw_flash (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
GtkAllocation alloc;
|
||||
|
||||
if (parasite->flash_count % 2 == 0)
|
||||
if (iw->flash_count % 2 == 0)
|
||||
return FALSE;
|
||||
|
||||
if (GTK_IS_WINDOW (widget))
|
||||
@ -337,17 +337,17 @@ draw_flash (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_flash_timeout (ParasiteWindow *parasite)
|
||||
on_flash_timeout (GtkInspectorWindow *iw)
|
||||
{
|
||||
gtk_widget_queue_draw (parasite->flash_widget);
|
||||
gtk_widget_queue_draw (iw->flash_widget);
|
||||
|
||||
parasite->flash_count++;
|
||||
iw->flash_count++;
|
||||
|
||||
if (parasite->flash_count == 6)
|
||||
if (iw->flash_count == 6)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (parasite->flash_widget, draw_flash, parasite);
|
||||
parasite->flash_widget = NULL;
|
||||
parasite->flash_cnx = 0;
|
||||
g_signal_handlers_disconnect_by_func (iw->flash_widget, draw_flash, iw);
|
||||
iw->flash_widget = NULL;
|
||||
iw->flash_cnx = 0;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -356,17 +356,17 @@ on_flash_timeout (ParasiteWindow *parasite)
|
||||
}
|
||||
|
||||
void
|
||||
gtkparasite_flash_widget (ParasiteWindow *parasite,
|
||||
GtkWidget *widget)
|
||||
gtk_inspector_flash_widget (GtkInspectorWindow *iw,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
if (parasite->flash_cnx != 0)
|
||||
if (iw->flash_cnx != 0)
|
||||
return;
|
||||
|
||||
if (!gtk_widget_get_visible (widget) || !gtk_widget_get_mapped (widget))
|
||||
return;
|
||||
|
||||
start_flash (parasite, widget);
|
||||
parasite->flash_cnx = g_timeout_add (150, (GSourceFunc) on_flash_timeout, parasite);
|
||||
start_flash (iw, widget);
|
||||
iw->flash_cnx = g_timeout_add (150, (GSourceFunc) on_flash_timeout, iw);
|
||||
}
|
||||
|
||||
/* vim: set et sw=2 ts=2: */
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/gtk/parasite">
|
||||
<gresource prefix="/org/gtk/inspector">
|
||||
<file>button-path.ui</file>
|
||||
<file>object-hierarchy.ui</file>
|
||||
<file>css-editor.ui</file>
|
@ -39,21 +39,21 @@ void
|
||||
gtk_module_init (gint *argc, gchar ***argv)
|
||||
{
|
||||
#ifdef ENABLE_PYTHON
|
||||
parasite_python_init ();
|
||||
gtk_inspector_python_init ();
|
||||
#endif
|
||||
|
||||
parasite_register_resource ();
|
||||
gtk_inspector_register_resource ();
|
||||
|
||||
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);
|
||||
g_type_ensure (PARASITE_TYPE_WINDOW);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_THEMES);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_CSS_EDITOR);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_BUTTON_PATH);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_WIDGET_TREE);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_PROP_LIST);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_CLASSES_LIST);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_PYTHON_SHELL);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_WINDOW);
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,40 +27,40 @@ enum
|
||||
COLUMN_OBJECT_NAME
|
||||
};
|
||||
|
||||
struct _ParasiteObjectHierarchyPrivate
|
||||
struct _GtkInspectorObjectHierarchyPrivate
|
||||
{
|
||||
GtkTreeStore *model;
|
||||
GtkTreeView *tree;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasiteObjectHierarchy, parasite_object_hierarchy, GTK_TYPE_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorObjectHierarchy, gtk_inspector_object_hierarchy, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
parasite_object_hierarchy_init (ParasiteObjectHierarchy *oh)
|
||||
gtk_inspector_object_hierarchy_init (GtkInspectorObjectHierarchy *oh)
|
||||
{
|
||||
oh->priv = parasite_object_hierarchy_get_instance_private (oh);
|
||||
oh->priv = gtk_inspector_object_hierarchy_get_instance_private (oh);
|
||||
gtk_widget_init_template (GTK_WIDGET (oh));
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_object_hierarchy_class_init (ParasiteObjectHierarchyClass *klass)
|
||||
gtk_inspector_object_hierarchy_class_init (GtkInspectorObjectHierarchyClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/object-hierarchy.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteObjectHierarchy, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteObjectHierarchy, tree);
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/object-hierarchy.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, tree);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_object_hierarchy_new (void)
|
||||
gtk_inspector_object_hierarchy_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (PARASITE_TYPE_OBJECT_HIERARCHY, NULL));
|
||||
return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, NULL));
|
||||
}
|
||||
|
||||
void
|
||||
parasite_object_hierarchy_set_object (ParasiteObjectHierarchy *oh,
|
||||
GObject *object)
|
||||
gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
|
||||
GObject *object)
|
||||
{
|
||||
GObjectClass *klass = G_OBJECT_GET_CLASS (object);
|
||||
const gchar *class_name;
|
||||
|
@ -20,41 +20,41 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _GTKPARASITE_OBJECT_HIERARCHY_H_
|
||||
#define _GTKPARASITE_OBJECT_HIERARCHY_H_
|
||||
#ifndef _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
|
||||
#define _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PARASITE_TYPE_OBJECT_HIERARCHY (parasite_object_hierarchy_get_type())
|
||||
#define PARASITE_OBJECT_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_OBJECT_HIERARCHY, ParasiteObjectHierarchy))
|
||||
#define PARASITE_OBJECT_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_OBJECT_HIERARCHY, ParasiteObjectHierarchyClass))
|
||||
#define PARASITE_IS_OBJECT_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_OBJECT_HIERARCHY))
|
||||
#define PARASITE_IS_OBJECT_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_OBJECT_HIERARCHY))
|
||||
#define PARASITE_OBJECT_HIERARCHY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_OBJECT_HIERARCHY, ParasiteObjectHierarchyClass))
|
||||
#define GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY (gtk_inspector_object_hierarchy_get_type())
|
||||
#define GTK_INSPECTOR_OBJECT_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchy))
|
||||
#define GTK_INSPECTOR_OBJECT_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchyClass))
|
||||
#define GTK_INSPECTOR_IS_OBJECT_HIERARCHY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY))
|
||||
#define GTK_INSPECTOR_IS_OBJECT_HIERARCHY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY))
|
||||
#define GTK_INSPECTOR_OBJECT_HIERARCHY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY, GtkInspectorObjectHierarchyClass))
|
||||
|
||||
|
||||
typedef struct _ParasiteObjectHierarchyPrivate ParasiteObjectHierarchyPrivate;
|
||||
typedef struct _GtkInspectorObjectHierarchyPrivate GtkInspectorObjectHierarchyPrivate;
|
||||
|
||||
typedef struct _ParasiteObjectHierarchy
|
||||
typedef struct _GtkInspectorObjectHierarchy
|
||||
{
|
||||
GtkBox parent;
|
||||
ParasiteObjectHierarchyPrivate *priv;
|
||||
} ParasiteObjectHierarchy;
|
||||
GtkInspectorObjectHierarchyPrivate *priv;
|
||||
} GtkInspectorObjectHierarchy;
|
||||
|
||||
typedef struct _ParasiteObjectHierarchyClass
|
||||
typedef struct _GtkInspectorObjectHierarchyClass
|
||||
{
|
||||
GtkBoxClass parent;
|
||||
} ParasiteObjectHierarchyClass;
|
||||
} GtkInspectorObjectHierarchyClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType parasite_object_hierarchy_get_type (void);
|
||||
GtkWidget *parasite_object_hierarchy_new (void);
|
||||
void parasite_object_hierarchy_set_object (ParasiteObjectHierarchy *oh,
|
||||
GObject *object);
|
||||
GType gtk_inspector_object_hierarchy_get_type (void);
|
||||
GtkWidget *gtk_inspector_object_hierarchy_new (void);
|
||||
void gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
|
||||
GObject *object);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _GTKPARASITE_OBJECT_HIERARCHY_H_
|
||||
#endif // _GTK_INSPECTOR_OBJECT_HIERARCHY_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -5,7 +5,7 @@
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<template class="ParasiteObjectHierarchy" parent="GtkBox">
|
||||
<template class="GtkInspectorObjectHierarchy" parent="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
|
@ -42,7 +42,7 @@ enum
|
||||
PROP_CHILD_PROPERTIES
|
||||
};
|
||||
|
||||
struct _ParasitePropListPrivate
|
||||
struct _GtkInspectorPropListPrivate
|
||||
{
|
||||
GObject *object;
|
||||
GtkListStore *model;
|
||||
@ -53,12 +53,12 @@ struct _ParasitePropListPrivate
|
||||
gboolean child_properties;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasitePropList, parasite_prop_list, GTK_TYPE_TREE_VIEW)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropList, gtk_inspector_prop_list, GTK_TYPE_TREE_VIEW)
|
||||
|
||||
static void
|
||||
parasite_prop_list_init (ParasitePropList *pl)
|
||||
gtk_inspector_prop_list_init (GtkInspectorPropList *pl)
|
||||
{
|
||||
pl->priv = parasite_prop_list_get_instance_private (pl);
|
||||
pl->priv = gtk_inspector_prop_list_get_instance_private (pl);
|
||||
gtk_widget_init_template (GTK_WIDGET (pl));
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (pl->priv->model),
|
||||
COLUMN_NAME,
|
||||
@ -75,13 +75,13 @@ get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ParasitePropList *pl = PARASITE_PROP_LIST (object);
|
||||
GtkInspectorPropList *pl = GTK_INSPECTOR_PROP_LIST (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_WIDGET_TREE:
|
||||
g_value_take_object (value, pl->priv->widget_tree);
|
||||
g_object_set_data (G_OBJECT (pl->priv->value_renderer), "parasite-widget-tree", pl->priv->widget_tree);
|
||||
g_object_set_data (G_OBJECT (pl->priv->value_renderer), "gtk_inspector-widget-tree", pl->priv->widget_tree);
|
||||
break;
|
||||
|
||||
case PROP_CHILD_PROPERTIES:
|
||||
@ -103,7 +103,7 @@ set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ParasitePropList *pl = PARASITE_PROP_LIST (object);
|
||||
GtkInspectorPropList *pl = GTK_INSPECTOR_PROP_LIST (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
@ -122,7 +122,7 @@ set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_prop_list_class_init (ParasitePropListClass *klass)
|
||||
gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
@ -137,15 +137,15 @@ parasite_prop_list_class_init (ParasitePropListClass *klass)
|
||||
g_param_spec_boolean ("child-properties", "Child properties", "Child properties",
|
||||
FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/prop-list.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasitePropList, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasitePropList, value_renderer);
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/prop-list.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, value_renderer);
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_prop_list_update_prop (ParasitePropList *pl,
|
||||
GtkTreeIter *iter,
|
||||
GParamSpec *prop)
|
||||
gtk_inspector_prop_list_update_prop (GtkInspectorPropList *pl,
|
||||
GtkTreeIter *iter,
|
||||
GParamSpec *prop)
|
||||
{
|
||||
GValue gvalue = {0};
|
||||
gchar *value;
|
||||
@ -189,31 +189,31 @@ parasite_prop_list_update_prop (ParasitePropList *pl,
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_prop_list_prop_changed_cb (GObject *pspec,
|
||||
GParamSpec *prop,
|
||||
ParasitePropList *pl)
|
||||
gtk_inspector_prop_list_prop_changed_cb (GObject *pspec,
|
||||
GParamSpec *prop,
|
||||
GtkInspectorPropList *pl)
|
||||
{
|
||||
GtkTreeIter *iter = g_hash_table_lookup(pl->priv->prop_iters, prop->name);
|
||||
|
||||
if (iter != NULL)
|
||||
parasite_prop_list_update_prop (pl, iter, prop);
|
||||
gtk_inspector_prop_list_update_prop (pl, iter, prop);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_prop_list_new (GtkWidget *widget_tree,
|
||||
gboolean child_properties)
|
||||
gtk_inspector_prop_list_new (GtkWidget *widget_tree,
|
||||
gboolean child_properties)
|
||||
{
|
||||
g_type_ensure (PARASITE_TYPE_PROPERTY_CELL_RENDERER);
|
||||
g_type_ensure (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER);
|
||||
|
||||
return g_object_new (PARASITE_TYPE_PROP_LIST,
|
||||
return g_object_new (GTK_TYPE_INSPECTOR_PROP_LIST,
|
||||
"widget-tree", widget_tree,
|
||||
"child-properties", child_properties,
|
||||
NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
parasite_prop_list_set_object (ParasitePropList *pl,
|
||||
GObject *object)
|
||||
gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
|
||||
GObject *object)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GParamSpec **props;
|
||||
@ -268,7 +268,7 @@ parasite_prop_list_set_object (ParasitePropList *pl,
|
||||
continue;
|
||||
|
||||
gtk_list_store_append (pl->priv->model, &iter);
|
||||
parasite_prop_list_update_prop (pl, &iter, prop);
|
||||
gtk_inspector_prop_list_update_prop (pl, &iter, prop);
|
||||
|
||||
g_hash_table_insert (pl->priv->prop_iters, (gpointer) prop->name, gtk_tree_iter_copy (&iter));
|
||||
|
||||
@ -281,7 +281,7 @@ parasite_prop_list_set_object (ParasitePropList *pl,
|
||||
pl->priv->signal_cnxs =
|
||||
g_list_prepend (pl->priv->signal_cnxs,
|
||||
GINT_TO_POINTER (g_signal_connect(object, signal_name,
|
||||
G_CALLBACK (parasite_prop_list_prop_changed_cb), pl)));
|
||||
G_CALLBACK (gtk_inspector_prop_list_prop_changed_cb), pl)));
|
||||
|
||||
g_free (signal_name);
|
||||
}
|
||||
|
@ -20,44 +20,44 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _GTKPARASITE_PROP_LIST_H_
|
||||
#define _GTKPARASITE_PROP_LIST_H_
|
||||
#ifndef _GTK_INSPECTOR_PROP_LIST_H_
|
||||
#define _GTK_INSPECTOR_PROP_LIST_H_
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PARASITE_TYPE_PROP_LIST (parasite_prop_list_get_type())
|
||||
#define PARASITE_PROP_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_PROP_LIST, ParasitePropList))
|
||||
#define PARASITE_PROP_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_PROP_LIST, ParasitePropListClass))
|
||||
#define PARASITE_IS_PROP_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_PROP_LIST))
|
||||
#define PARASITE_IS_PROP_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_PROP_LIST))
|
||||
#define PARASITE_PROP_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_PROP_LIST, ParasitePropListClass))
|
||||
#define GTK_TYPE_INSPECTOR_PROP_LIST (gtk_inspector_prop_list_get_type())
|
||||
#define GTK_INSPECTOR_PROP_LIST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropList))
|
||||
#define GTK_INSPECTOR_PROP_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropListClass))
|
||||
#define GTK_INSPECTOR_IS_PROP_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PROP_LIST))
|
||||
#define GTK_INSPECTOR_IS_PROP_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PROP_LIST))
|
||||
#define GTK_INSPECTOR_PROP_LIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_PROP_LIST, GtkInspectorPropListClass))
|
||||
|
||||
|
||||
typedef struct _ParasitePropListPrivate ParasitePropListPrivate;
|
||||
typedef struct _GtkInspectorPropListPrivate GtkInspectorPropListPrivate;
|
||||
|
||||
typedef struct _ParasitePropList
|
||||
typedef struct _GtkInspectorPropList
|
||||
{
|
||||
GtkTreeView parent;
|
||||
ParasitePropListPrivate *priv;
|
||||
} ParasitePropList;
|
||||
GtkInspectorPropListPrivate *priv;
|
||||
} GtkInspectorPropList;
|
||||
|
||||
typedef struct _ParasitePropListClass
|
||||
typedef struct _GtkInspectorPropListClass
|
||||
{
|
||||
GtkTreeViewClass parent;
|
||||
} ParasitePropListClass;
|
||||
} GtkInspectorPropListClass;
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType parasite_prop_list_get_type (void);
|
||||
GtkWidget *parasite_prop_list_new (GtkWidget *widget_tree,
|
||||
gboolean child_properties);
|
||||
gboolean parasite_prop_list_set_object (ParasitePropList *pl,
|
||||
GObject *object);
|
||||
GType gtk_inspector_prop_list_get_type (void);
|
||||
GtkWidget *gtk_inspector_prop_list_new (GtkWidget *widget_tree,
|
||||
gboolean child_properties);
|
||||
gboolean gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
|
||||
GObject *object);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _GTKPARASITE_PROP_LIST_H_
|
||||
#endif // _GTK_INSPECTOR_PROP_LIST_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -10,7 +10,7 @@
|
||||
<column type="gboolean"/>
|
||||
</columns>
|
||||
</object>
|
||||
<template class="ParasitePropList" parent="GtkTreeView">
|
||||
<template class="GtkInspectorPropList" parent="GtkTreeView">
|
||||
<property name="model">model</property>
|
||||
<property name="tooltip-column">4</property>
|
||||
<child>
|
||||
@ -35,7 +35,7 @@
|
||||
<property name="title">Value</property>
|
||||
<property name="resizable">True</property>
|
||||
<child>
|
||||
<object class="ParasitePropertyCellRenderer" id="value_renderer">
|
||||
<object class="GtkInspectorPropertyCellRenderer" id="value_renderer">
|
||||
<property name="scale">0.8</property>
|
||||
<property name="editable">True</property>
|
||||
</object>
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "property-cell-renderer.h"
|
||||
#include "widget-tree.h"
|
||||
|
||||
struct _ParasitePropertyCellRendererPrivate
|
||||
struct _GtkInspectorPropertyCellRendererPrivate
|
||||
{
|
||||
GObject *object;
|
||||
char *name;
|
||||
@ -39,12 +39,12 @@ enum
|
||||
PROP_IS_CHILD_PROPERTY
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasitePropertyCellRenderer, parasite_property_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropertyCellRenderer, gtk_inspector_property_cell_renderer, GTK_TYPE_CELL_RENDERER_TEXT);
|
||||
|
||||
static void
|
||||
parasite_property_cell_renderer_init(ParasitePropertyCellRenderer *renderer)
|
||||
gtk_inspector_property_cell_renderer_init(GtkInspectorPropertyCellRenderer *renderer)
|
||||
{
|
||||
renderer->priv = parasite_property_cell_renderer_get_instance_private (renderer);
|
||||
renderer->priv = gtk_inspector_property_cell_renderer_get_instance_private (renderer);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -53,7 +53,7 @@ get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ParasitePropertyCellRenderer *r = PARASITE_PROPERTY_CELL_RENDERER (object);
|
||||
GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
@ -81,7 +81,7 @@ set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ParasitePropertyCellRenderer *r = PARASITE_PROPERTY_CELL_RENDERER (object);
|
||||
GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
@ -108,7 +108,7 @@ set_property (GObject *object,
|
||||
static GParamSpec *
|
||||
find_property (GtkCellRenderer *renderer)
|
||||
{
|
||||
ParasitePropertyCellRenderer *r = PARASITE_PROPERTY_CELL_RENDERER (renderer);
|
||||
GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
|
||||
|
||||
if (r->priv->is_child_property)
|
||||
{
|
||||
@ -126,7 +126,7 @@ static void
|
||||
get_value (GtkCellRenderer *renderer,
|
||||
GValue *gvalue)
|
||||
{
|
||||
ParasitePropertyCellRenderer *r = PARASITE_PROPERTY_CELL_RENDERER (renderer);
|
||||
GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
|
||||
|
||||
if (r->priv->is_child_property)
|
||||
{
|
||||
@ -146,7 +146,7 @@ static void
|
||||
set_value (GtkCellRenderer *renderer,
|
||||
GValue *gvalue)
|
||||
{
|
||||
ParasitePropertyCellRenderer *r = PARASITE_PROPERTY_CELL_RENDERER (renderer);
|
||||
GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
|
||||
|
||||
if (r->priv->is_child_property)
|
||||
{
|
||||
@ -251,7 +251,7 @@ start_editing (GtkCellRenderer *renderer,
|
||||
GtkCellEditable *editable = NULL;
|
||||
GValue gvalue = {0};
|
||||
GParamSpec *prop;
|
||||
ParasitePropertyCellRenderer *r = PARASITE_PROPERTY_CELL_RENDERER (renderer);
|
||||
GtkInspectorPropertyCellRenderer *r = GTK_INSPECTOR_PROPERTY_CELL_RENDERER (renderer);
|
||||
|
||||
prop = find_property (renderer);
|
||||
|
||||
@ -261,25 +261,25 @@ start_editing (GtkCellRenderer *renderer,
|
||||
|
||||
if (G_VALUE_HOLDS_OBJECT (&gvalue))
|
||||
{
|
||||
ParasiteWidgetTree *widget_tree = g_object_get_data (G_OBJECT (renderer), "parasite-widget-tree");
|
||||
GtkInspectorWidgetTree *widget_tree = g_object_get_data (G_OBJECT (renderer), "gtk_inspector-widget-tree");
|
||||
GObject *prop_object = g_value_get_object (&gvalue);
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (prop_object)
|
||||
{
|
||||
/* First check if the value is already in the tree (happens with 'parent' for instance) */
|
||||
if (parasite_widget_tree_find_object (widget_tree, prop_object, &iter))
|
||||
if (gtk_inspector_widget_tree_find_object (widget_tree, prop_object, &iter))
|
||||
{
|
||||
parasite_widget_tree_select_object (widget_tree, prop_object);
|
||||
gtk_inspector_widget_tree_select_object (widget_tree, prop_object);
|
||||
}
|
||||
else if (parasite_widget_tree_find_object (widget_tree, r->priv->object, &iter))
|
||||
else if (gtk_inspector_widget_tree_find_object (widget_tree, r->priv->object, &iter))
|
||||
{
|
||||
parasite_widget_tree_append_object (widget_tree, prop_object, &iter);
|
||||
parasite_widget_tree_select_object (widget_tree, prop_object);
|
||||
gtk_inspector_widget_tree_append_object (widget_tree, prop_object, &iter);
|
||||
gtk_inspector_widget_tree_select_object (widget_tree, prop_object);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Parasite: couldn't find the widget in the tree");
|
||||
g_warning ("GtkInspector: couldn't find the widget in the tree");
|
||||
}
|
||||
}
|
||||
g_value_unset (&gvalue);
|
||||
@ -433,7 +433,7 @@ start_editing (GtkCellRenderer *renderer,
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_property_cell_renderer_class_init (ParasitePropertyCellRendererClass *klass)
|
||||
gtk_inspector_property_cell_renderer_class_init (GtkInspectorPropertyCellRendererClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (klass);
|
||||
@ -457,9 +457,9 @@ parasite_property_cell_renderer_class_init (ParasitePropertyCellRendererClass *k
|
||||
}
|
||||
|
||||
GtkCellRenderer *
|
||||
parasite_property_cell_renderer_new (void)
|
||||
gtk_inspector_property_cell_renderer_new (void)
|
||||
{
|
||||
return g_object_new (PARASITE_TYPE_PROPERTY_CELL_RENDERER, NULL);
|
||||
return g_object_new (GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,44 +20,44 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _GTKPARASITE_PROPERTY_CELL_RENDERER_H_
|
||||
#define _GTKPARASITE_PROPERTY_CELL_RENDERER_H_
|
||||
#ifndef _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
|
||||
#define _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
#define PARASITE_TYPE_PROPERTY_CELL_RENDERER (parasite_property_cell_renderer_get_type())
|
||||
#define PARASITE_PROPERTY_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_PROPERTY_CELL_RENDERER, ParasitePropertyCellRenderer))
|
||||
#define PARASITE_PROPERTY_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_PROPERTY_CELL_RENDERER, ParasitePropertyCellRendererClass))
|
||||
#define PARASITE_IS_PROPERTY_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_PROPERTY_CELL_RENDERER))
|
||||
#define PARASITE_IS_PROPERTY_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_PROPERTY_CELL_RENDERER))
|
||||
#define PARASITE_PROPERTY_CELL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_PROPERTY_CELL_RENDERER, ParasitePropertyCellRendererClass))
|
||||
#define GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER (gtk_inspector_property_cell_renderer_get_type())
|
||||
#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRenderer))
|
||||
#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRendererClass))
|
||||
#define GTK_INSPECTOR_IS_PROPERTY_CELL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER))
|
||||
#define GTK_INSPECTOR_IS_PROPERTY_CELL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER))
|
||||
#define GTK_INSPECTOR_PROPERTY_CELL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_PROPERTY_CELL_RENDERER, GtkInspectorPropertyCellRendererClass))
|
||||
|
||||
typedef struct _ParasitePropertyCellRendererPrivate ParasitePropertyCellRendererPrivate;
|
||||
typedef struct _GtkInspectorPropertyCellRendererPrivate GtkInspectorPropertyCellRendererPrivate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkCellRendererText parent;
|
||||
ParasitePropertyCellRendererPrivate *priv;
|
||||
} ParasitePropertyCellRenderer;
|
||||
GtkInspectorPropertyCellRendererPrivate *priv;
|
||||
} GtkInspectorPropertyCellRenderer;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkCellRendererTextClass parent;
|
||||
} ParasitePropertyCellRendererClass;
|
||||
} GtkInspectorPropertyCellRendererClass;
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
GType parasite_property_cell_renderer_get_type (void);
|
||||
GtkCellRenderer *parasite_property_cell_renderer_new (void);
|
||||
GType gtk_inspector_property_cell_renderer_get_type (void);
|
||||
GtkCellRenderer *gtk_inspector_property_cell_renderer_new (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
#endif // _GTKPARASITE_PROPERTY_CELL_RENDERER_H_
|
||||
#endif // _GTK_INSPECTOR_PROPERTY_CELL_RENDERER_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -85,7 +85,7 @@ wrap_gobj(PyObject *self, PyObject *args)
|
||||
return pygobject_new(obj);
|
||||
}
|
||||
|
||||
static PyMethodDef parasite_python_methods[] = {
|
||||
static PyMethodDef gtk_inspector_python_methods[] = {
|
||||
{"capture_stdout", capture_stdout, METH_VARARGS, "Captures stdout"},
|
||||
{"capture_stderr", capture_stderr, METH_VARARGS, "Captures stderr"},
|
||||
{"gobj", wrap_gobj, METH_VARARGS, "Wraps a C GObject"},
|
||||
@ -103,7 +103,7 @@ is_blacklisted(void)
|
||||
#endif // ENABLE_PYTHON
|
||||
|
||||
void
|
||||
parasite_python_init(void)
|
||||
gtk_inspector_python_init(void)
|
||||
{
|
||||
#ifdef ENABLE_PYTHON
|
||||
int res;
|
||||
@ -130,18 +130,18 @@ parasite_python_init(void)
|
||||
|
||||
res = sigaction(SIGINT, &old_sigint, NULL);
|
||||
|
||||
Py_InitModule("parasite", parasite_python_methods);
|
||||
Py_InitModule("gtk_inspector", gtk_inspector_python_methods);
|
||||
PyRun_SimpleString(
|
||||
"import parasite\n"
|
||||
"import gtk_inspector\n"
|
||||
"import sys\n"
|
||||
"\n"
|
||||
"class StdoutCatcher:\n"
|
||||
" def write(self, str):\n"
|
||||
" parasite.capture_stdout(str)\n"
|
||||
" gtk_inspector.capture_stdout(str)\n"
|
||||
"\n"
|
||||
"class StderrCatcher:\n"
|
||||
" def write(self, str):\n"
|
||||
" parasite.capture_stderr(str)\n"
|
||||
" gtk_inspector.capture_stderr(str)\n"
|
||||
"\n"
|
||||
);
|
||||
|
||||
@ -176,9 +176,9 @@ parasite_python_init(void)
|
||||
}
|
||||
|
||||
void
|
||||
parasite_python_run(const char *command,
|
||||
ParasitePythonLogger stdout_logger,
|
||||
ParasitePythonLogger stderr_logger,
|
||||
gtk_inspector_python_run(const char *command,
|
||||
GtkInspectorPythonLogger stdout_logger,
|
||||
GtkInspectorPythonLogger stderr_logger,
|
||||
gpointer user_data)
|
||||
{
|
||||
#ifdef ENABLE_PYTHON
|
||||
@ -229,7 +229,7 @@ parasite_python_run(const char *command,
|
||||
}
|
||||
|
||||
gboolean
|
||||
parasite_python_is_enabled(void)
|
||||
gtk_inspector_python_is_enabled(void)
|
||||
{
|
||||
return python_enabled;
|
||||
}
|
||||
|
@ -20,19 +20,19 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _GTKPARASITE_PYTHON_MODULE_H_
|
||||
#define _GTKPARASITE_PYTHON_MODULE_H_
|
||||
#ifndef _GTK_INSPECTOR_PYTHON_MODULE_H_
|
||||
#define _GTK_INSPECTOR_PYTHON_MODULE_H_
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
|
||||
typedef void (*ParasitePythonLogger)(const char *text, gpointer user_data);
|
||||
typedef void (*GtkInspectorPythonLogger)(const char *text, gpointer user_data);
|
||||
|
||||
void parasite_python_init(void);
|
||||
void parasite_python_run(const char *command,
|
||||
ParasitePythonLogger stdout_logger,
|
||||
ParasitePythonLogger stderr_logger,
|
||||
void gtk_inspector_python_init(void);
|
||||
void gtk_inspector_python_run(const char *command,
|
||||
GtkInspectorPythonLogger stdout_logger,
|
||||
GtkInspectorPythonLogger stderr_logger,
|
||||
gpointer user_data);
|
||||
gboolean parasite_python_is_enabled(void);
|
||||
gboolean gtk_inspector_python_is_enabled(void);
|
||||
|
||||
#endif // _GTKPARASITE_PYTHON_MODULE_H_
|
||||
#endif // _GTK_INSPECTOR_PYTHON_MODULE_H_
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define MAX_HISTORY_LENGTH 20
|
||||
|
||||
struct _ParasitePythonShellPrivate
|
||||
struct _GtkInspectorPythonShellPrivate
|
||||
{
|
||||
GtkWidget *textview;
|
||||
|
||||
@ -42,36 +42,36 @@ struct _ParasitePythonShellPrivate
|
||||
gboolean in_block;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasitePythonShell, parasite_python_shell, GTK_TYPE_BOX);
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPythonShell, gtk_inspector_python_shell, GTK_TYPE_BOX);
|
||||
|
||||
/* Widget functions */
|
||||
static void parasite_python_shell_finalize (GObject *obj);
|
||||
static void gtk_inspector_python_shell_finalize (GObject *obj);
|
||||
|
||||
/* Python integration */
|
||||
static void parasite_python_shell_write_prompt(GtkWidget *python_shell);
|
||||
static char *parasite_python_shell_get_input(GtkWidget *python_shell);
|
||||
static void gtk_inspector_python_shell_write_prompt(GtkWidget *python_shell);
|
||||
static char *gtk_inspector_python_shell_get_input(GtkWidget *python_shell);
|
||||
|
||||
/* Callbacks */
|
||||
static gboolean parasite_python_shell_key_press_cb(GtkWidget *textview,
|
||||
static gboolean gtk_inspector_python_shell_key_press_cb(GtkWidget *textview,
|
||||
GdkEventKey *event,
|
||||
GtkWidget *python_shell);
|
||||
static void
|
||||
parasite_python_shell_class_init(ParasitePythonShellClass *klass)
|
||||
gtk_inspector_python_shell_class_init(GtkInspectorPythonShellClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
|
||||
object_class->finalize = parasite_python_shell_finalize;
|
||||
object_class->finalize = gtk_inspector_python_shell_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_python_shell_init (ParasitePythonShell *python_shell)
|
||||
gtk_inspector_python_shell_init (GtkInspectorPythonShell *python_shell)
|
||||
{
|
||||
GtkWidget *swin;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
python_shell->priv = parasite_python_shell_get_instance_private (python_shell);
|
||||
python_shell->priv = gtk_inspector_python_shell_get_instance_private (python_shell);
|
||||
|
||||
python_shell->priv->history = g_queue_new();
|
||||
|
||||
@ -94,7 +94,7 @@ parasite_python_shell_init (ParasitePythonShell *python_shell)
|
||||
gtk_text_view_set_right_margin(GTK_TEXT_VIEW(python_shell->priv->textview), 3);
|
||||
|
||||
g_signal_connect(python_shell->priv->textview, "key_press_event",
|
||||
G_CALLBACK(parasite_python_shell_key_press_cb),
|
||||
G_CALLBACK(gtk_inspector_python_shell_key_press_cb),
|
||||
python_shell);
|
||||
|
||||
/* Make the textview monospaced */
|
||||
@ -124,41 +124,41 @@ parasite_python_shell_init (ParasitePythonShell *python_shell)
|
||||
"foreground", "blue",
|
||||
NULL);
|
||||
|
||||
parasite_python_shell_write_prompt(GTK_WIDGET(python_shell));
|
||||
gtk_inspector_python_shell_write_prompt(GTK_WIDGET(python_shell));
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_python_shell_finalize(GObject *python_shell)
|
||||
gtk_inspector_python_shell_finalize(GObject *python_shell)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = PARASITE_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
|
||||
|
||||
g_queue_free(priv->history);
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_python_shell_log_stdout(const char *text, gpointer python_shell)
|
||||
gtk_inspector_python_shell_log_stdout(const char *text, gpointer python_shell)
|
||||
{
|
||||
parasite_python_shell_append_text(PARASITE_PYTHON_SHELL(python_shell),
|
||||
gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
|
||||
text, "stdout");
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_python_shell_log_stderr(const char *text, gpointer python_shell)
|
||||
gtk_inspector_python_shell_log_stderr(const char *text, gpointer python_shell)
|
||||
{
|
||||
parasite_python_shell_append_text(PARASITE_PYTHON_SHELL(python_shell),
|
||||
gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
|
||||
text, "stderr");
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_python_shell_write_prompt(GtkWidget *python_shell)
|
||||
gtk_inspector_python_shell_write_prompt(GtkWidget *python_shell)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = PARASITE_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkTextBuffer *buffer =
|
||||
gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
|
||||
GtkTextIter iter;
|
||||
const char *prompt = (priv->pending_command == NULL ? ">>> " : "... ");
|
||||
|
||||
parasite_python_shell_append_text(PARASITE_PYTHON_SHELL(python_shell),
|
||||
gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
|
||||
prompt, "prompt");
|
||||
|
||||
gtk_text_buffer_get_end_iter(buffer, &iter);
|
||||
@ -166,13 +166,13 @@ parasite_python_shell_write_prompt(GtkWidget *python_shell)
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_python_shell_process_line(GtkWidget *python_shell)
|
||||
gtk_inspector_python_shell_process_line(GtkWidget *python_shell)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = PARASITE_PYTHON_SHELL(python_shell)->priv;
|
||||
char *command = parasite_python_shell_get_input(python_shell);
|
||||
GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
|
||||
char *command = gtk_inspector_python_shell_get_input(python_shell);
|
||||
char last_char;
|
||||
|
||||
parasite_python_shell_append_text(PARASITE_PYTHON_SHELL(python_shell),
|
||||
gtk_inspector_python_shell_append_text(GTK_INSPECTOR_PYTHON_SHELL(python_shell),
|
||||
"\n", NULL);
|
||||
|
||||
if (*command != '\0')
|
||||
@ -215,9 +215,9 @@ parasite_python_shell_process_line(GtkWidget *python_shell)
|
||||
command = g_string_free(priv->pending_command, FALSE);
|
||||
}
|
||||
|
||||
parasite_python_run(command,
|
||||
parasite_python_shell_log_stdout,
|
||||
parasite_python_shell_log_stderr,
|
||||
gtk_inspector_python_run(command,
|
||||
gtk_inspector_python_shell_log_stdout,
|
||||
gtk_inspector_python_shell_log_stderr,
|
||||
python_shell);
|
||||
|
||||
if (priv->pending_command != NULL)
|
||||
@ -229,14 +229,14 @@ parasite_python_shell_process_line(GtkWidget *python_shell)
|
||||
}
|
||||
}
|
||||
|
||||
parasite_python_shell_write_prompt(python_shell);
|
||||
gtk_inspector_python_shell_write_prompt(python_shell);
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_python_shell_replace_input(GtkWidget *python_shell,
|
||||
gtk_inspector_python_shell_replace_input(GtkWidget *python_shell,
|
||||
const char *text)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = PARASITE_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkTextBuffer *buffer =
|
||||
gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
|
||||
GtkTextIter start_iter;
|
||||
@ -251,9 +251,9 @@ parasite_python_shell_replace_input(GtkWidget *python_shell,
|
||||
}
|
||||
|
||||
static char *
|
||||
parasite_python_shell_get_input(GtkWidget *python_shell)
|
||||
gtk_inspector_python_shell_get_input(GtkWidget *python_shell)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = PARASITE_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkTextBuffer *buffer =
|
||||
gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
|
||||
GtkTextIter start_iter;
|
||||
@ -267,9 +267,9 @@ parasite_python_shell_get_input(GtkWidget *python_shell)
|
||||
}
|
||||
|
||||
static const char *
|
||||
parasite_python_shell_get_history_back(GtkWidget *python_shell)
|
||||
gtk_inspector_python_shell_get_history_back(GtkWidget *python_shell)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = PARASITE_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
|
||||
|
||||
if (priv->cur_history_item == NULL)
|
||||
{
|
||||
@ -285,9 +285,9 @@ parasite_python_shell_get_history_back(GtkWidget *python_shell)
|
||||
}
|
||||
|
||||
static const char *
|
||||
parasite_python_shell_get_history_forward(GtkWidget *python_shell)
|
||||
gtk_inspector_python_shell_get_history_forward(GtkWidget *python_shell)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = PARASITE_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
|
||||
|
||||
if (priv->cur_history_item == NULL || priv->cur_history_item->prev == NULL)
|
||||
{
|
||||
@ -301,30 +301,30 @@ parasite_python_shell_get_history_forward(GtkWidget *python_shell)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parasite_python_shell_key_press_cb(GtkWidget *textview,
|
||||
gtk_inspector_python_shell_key_press_cb(GtkWidget *textview,
|
||||
GdkEventKey *event,
|
||||
GtkWidget *python_shell)
|
||||
{
|
||||
if (event->keyval == GDK_KEY_Return)
|
||||
{
|
||||
parasite_python_shell_process_line(python_shell);
|
||||
gtk_inspector_python_shell_process_line(python_shell);
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Up)
|
||||
{
|
||||
parasite_python_shell_replace_input(python_shell,
|
||||
parasite_python_shell_get_history_back(python_shell));
|
||||
gtk_inspector_python_shell_replace_input(python_shell,
|
||||
gtk_inspector_python_shell_get_history_back(python_shell));
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Down)
|
||||
{
|
||||
parasite_python_shell_replace_input(python_shell,
|
||||
parasite_python_shell_get_history_forward(python_shell));
|
||||
gtk_inspector_python_shell_replace_input(python_shell,
|
||||
gtk_inspector_python_shell_get_history_forward(python_shell));
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->string != NULL)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = PARASITE_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkInspectorPythonShellPrivate *priv = GTK_INSPECTOR_PYTHON_SHELL(python_shell)->priv;
|
||||
GtkTextBuffer *buffer =
|
||||
gtk_text_view_get_buffer(GTK_TEXT_VIEW(priv->textview));
|
||||
GtkTextMark *insert_mark = gtk_text_buffer_get_insert(buffer);
|
||||
@ -376,17 +376,17 @@ parasite_python_shell_key_press_cb(GtkWidget *textview,
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_python_shell_new(void)
|
||||
gtk_inspector_python_shell_new(void)
|
||||
{
|
||||
return g_object_new(PARASITE_TYPE_PYTHON_SHELL, NULL);
|
||||
return g_object_new(GTK_TYPE_INSPECTOR_PYTHON_SHELL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
parasite_python_shell_append_text(ParasitePythonShell *python_shell,
|
||||
gtk_inspector_python_shell_append_text(GtkInspectorPythonShell *python_shell,
|
||||
const char *str,
|
||||
const char *tag)
|
||||
{
|
||||
ParasitePythonShellPrivate *priv = python_shell->priv;
|
||||
GtkInspectorPythonShellPrivate *priv = python_shell->priv;
|
||||
|
||||
GtkTextIter end;
|
||||
GtkTextBuffer *buffer =
|
||||
@ -401,7 +401,7 @@ parasite_python_shell_append_text(ParasitePythonShell *python_shell,
|
||||
}
|
||||
|
||||
void
|
||||
parasite_python_shell_focus(ParasitePythonShell *python_shell)
|
||||
gtk_inspector_python_shell_focus(GtkInspectorPythonShell *python_shell)
|
||||
{
|
||||
gtk_widget_grab_focus (python_shell->priv->textview);
|
||||
}
|
||||
|
@ -20,49 +20,49 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _PARASITE_PYTHON_SHELL_H_
|
||||
#define _PARASITE_PYTHON_SHELL_H_
|
||||
#ifndef _GTK_INSPECTOR_PYTHON_SHELL_H_
|
||||
#define _GTK_INSPECTOR_PYTHON_SHELL_H_
|
||||
|
||||
typedef struct _ParasitePythonShell ParasitePythonShell;
|
||||
typedef struct _ParasitePythonShellClass ParasitePythonShellClass;
|
||||
typedef struct _ParasitePythonShellPrivate ParasitePythonShellPrivate;
|
||||
typedef struct _GtkInspectorPythonShell GtkInspectorPythonShell;
|
||||
typedef struct _GtkInspectorPythonShellClass GtkInspectorPythonShellClass;
|
||||
typedef struct _GtkInspectorPythonShellPrivate GtkInspectorPythonShellPrivate;
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PARASITE_TYPE_PYTHON_SHELL (parasite_python_shell_get_type())
|
||||
#define PARASITE_PYTHON_SHELL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_PYTHON_SHELL, ParasitePythonShell))
|
||||
#define PARASITE_PYTHON_SHELL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_PYTHON_SHELL, ParasitePythonShellClass))
|
||||
#define PARASITE_IS_PYTHON_SHELL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_PYTHON_SHELL))
|
||||
#define PARASITE_IS_PYTHON_SHELL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_PYTHON_SHELL))
|
||||
#define PARASITE_PYTHON_SHELL_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), PARASITE_TYPE_PYTHON_SHELL, ParasitePythonShellClass))
|
||||
#define GTK_TYPE_INSPECTOR_PYTHON_SHELL (gtk_inspector_python_shell_get_type())
|
||||
#define GTK_INSPECTOR_PYTHON_SHELL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShell))
|
||||
#define GTK_INSPECTOR_PYTHON_SHELL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShellClass))
|
||||
#define GTK_INSPECTOR_IS_PYTHON_SHELL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL))
|
||||
#define GTK_INSPECTOR_IS_PYTHON_SHELL_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_PYTHON_SHELL))
|
||||
#define GTK_INSPECTOR_PYTHON_SHELL_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_INSPECTOR_PYTHON_SHELL, GtkInspectorPythonShellClass))
|
||||
|
||||
|
||||
struct _ParasitePythonShell
|
||||
struct _GtkInspectorPythonShell
|
||||
{
|
||||
GtkBox parent_object;
|
||||
ParasitePythonShellPrivate *priv;
|
||||
GtkInspectorPythonShellPrivate *priv;
|
||||
};
|
||||
|
||||
struct _ParasitePythonShellClass
|
||||
struct _GtkInspectorPythonShellClass
|
||||
{
|
||||
GtkBoxClass parent_class;
|
||||
};
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType parasite_python_shell_get_type(void);
|
||||
GType gtk_inspector_python_shell_get_type(void);
|
||||
|
||||
GtkWidget *parasite_python_shell_new(void);
|
||||
void parasite_python_shell_append_text(ParasitePythonShell *python_shell,
|
||||
GtkWidget *gtk_inspector_python_shell_new(void);
|
||||
void gtk_inspector_python_shell_append_text(GtkInspectorPythonShell *python_shell,
|
||||
const char *str,
|
||||
const char *tag);
|
||||
void parasite_python_shell_focus(ParasitePythonShell *python_shell);
|
||||
void gtk_inspector_python_shell_focus(GtkInspectorPythonShell *python_shell);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _PARASITE_PYTHON_SHELL_H_
|
||||
#endif // _GTK_INSPECTOR_PYTHON_SHELL_H_
|
||||
|
@ -22,17 +22,17 @@
|
||||
|
||||
#include "themes.h"
|
||||
|
||||
struct _ParasiteThemesPrivate
|
||||
struct _GtkInspectorThemesPrivate
|
||||
{
|
||||
GtkWidget *dark_switch;
|
||||
GtkWidget *theme_combo;
|
||||
GtkWidget *icon_combo;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasiteThemes, parasite_themes, GTK_TYPE_LIST_BOX)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorThemes, gtk_inspector_themes, GTK_TYPE_LIST_BOX)
|
||||
|
||||
static void
|
||||
init_dark (ParasiteThemes *pt)
|
||||
init_dark (GtkInspectorThemes *pt)
|
||||
{
|
||||
g_object_bind_property (pt->priv->dark_switch, "active",
|
||||
gtk_settings_get_default (), "gtk-application-prefer-dark-theme",
|
||||
@ -62,7 +62,7 @@ fill_gtk (const gchar *path,
|
||||
}
|
||||
|
||||
static void
|
||||
init_theme (ParasiteThemes *pt)
|
||||
init_theme (GtkInspectorThemes *pt)
|
||||
{
|
||||
GHashTable *t;
|
||||
GHashTableIter iter;
|
||||
@ -120,7 +120,7 @@ fill_icons (const gchar *path,
|
||||
}
|
||||
|
||||
static void
|
||||
init_icons (ParasiteThemes *pt)
|
||||
init_icons (GtkInspectorThemes *pt)
|
||||
{
|
||||
GHashTable *t;
|
||||
GHashTableIter iter;
|
||||
@ -154,8 +154,8 @@ init_icons (ParasiteThemes *pt)
|
||||
}
|
||||
|
||||
static void
|
||||
theme_changed (GtkComboBox *c,
|
||||
ParasiteThemes *pt)
|
||||
theme_changed (GtkComboBox *c,
|
||||
GtkInspectorThemes *pt)
|
||||
{
|
||||
gchar *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
|
||||
g_object_set (gtk_settings_get_default (), "gtk-theme-name", theme, NULL);
|
||||
@ -163,8 +163,8 @@ theme_changed (GtkComboBox *c,
|
||||
}
|
||||
|
||||
static void
|
||||
icons_changed (GtkComboBox *c,
|
||||
ParasiteThemes *pt)
|
||||
icons_changed (GtkComboBox *c,
|
||||
GtkInspectorThemes *pt)
|
||||
{
|
||||
gchar *theme = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (c));
|
||||
g_object_set (gtk_settings_get_default (), "gtk-icon-theme-name", theme, NULL);
|
||||
@ -172,9 +172,9 @@ icons_changed (GtkComboBox *c,
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_themes_init (ParasiteThemes *pt)
|
||||
gtk_inspector_themes_init (GtkInspectorThemes *pt)
|
||||
{
|
||||
pt->priv = parasite_themes_get_instance_private (pt);
|
||||
pt->priv = gtk_inspector_themes_get_instance_private (pt);
|
||||
gtk_widget_init_template (GTK_WIDGET (pt));
|
||||
|
||||
init_dark (pt);
|
||||
@ -183,23 +183,23 @@ parasite_themes_init (ParasiteThemes *pt)
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_themes_class_init (ParasiteThemesClass *klass)
|
||||
gtk_inspector_themes_class_init (GtkInspectorThemesClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/themes.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteThemes, dark_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteThemes, theme_combo);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteThemes, icon_combo);
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/themes.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, dark_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, theme_combo);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorThemes, icon_combo);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, theme_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, icons_changed);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_themes_new (void)
|
||||
gtk_inspector_themes_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (PARASITE_TYPE_THEMES, NULL));
|
||||
return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_THEMES, NULL));
|
||||
}
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -20,39 +20,39 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _GTKPARASITE_THEMES_H_
|
||||
#define _GTKPARASITE_THEMES_H_
|
||||
#ifndef _GTK_INSPECTOR_THEMES_H_
|
||||
#define _GTK_INSPECTOR_THEMES_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define PARASITE_TYPE_THEMES (parasite_themes_get_type())
|
||||
#define PARASITE_THEMES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_THEMES, ParasiteThemes))
|
||||
#define PARASITE_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_THEMES, ParasiteThemesClass))
|
||||
#define PARASITE_IS_THEMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_THEMES))
|
||||
#define PARASITE_IS_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_THEMES))
|
||||
#define PARASITE_THEMES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_THEMES, ParasiteThemesClass))
|
||||
#define GTK_TYPE_INSPECTOR_THEMES (gtk_inspector_themes_get_type())
|
||||
#define GTK_INSPECTOR_THEMES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemes))
|
||||
#define GTK_INSPECTOR_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemesClass))
|
||||
#define GTK_INSPECTOR_IS_THEMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_THEMES))
|
||||
#define GTK_INSPECTOR_IS_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_THEMES))
|
||||
#define GTK_INSPECTOR_THEMES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_THEMES, GtkInspectorThemesClass))
|
||||
|
||||
|
||||
typedef struct _ParasiteThemesPrivate ParasiteThemesPrivate;
|
||||
typedef struct _GtkInspectorThemesPrivate GtkInspectorThemesPrivate;
|
||||
|
||||
typedef struct _ParasiteThemes
|
||||
typedef struct _GtkInspectorThemes
|
||||
{
|
||||
GtkListBox parent;
|
||||
ParasiteThemesPrivate *priv;
|
||||
} ParasiteThemes;
|
||||
GtkInspectorThemesPrivate *priv;
|
||||
} GtkInspectorThemes;
|
||||
|
||||
typedef struct _ParasiteThemesClass
|
||||
typedef struct _GtkInspectorThemesClass
|
||||
{
|
||||
GtkListBoxClass parent;
|
||||
} ParasiteThemesClass;
|
||||
} GtkInspectorThemesClass;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType parasite_themes_get_type (void);
|
||||
GtkWidget *parasite_themes_new (void);
|
||||
GType gtk_inspector_themes_get_type (void);
|
||||
GtkWidget *gtk_inspector_themes_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _GTKPARASITE_THEMES_H_
|
||||
#endif // _GTK_INSPECTOR_THEMES_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="ParasiteThemes" parent="GtkListBox">
|
||||
<template class="GtkInspectorThemes" parent="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
|
@ -46,7 +46,7 @@ enum
|
||||
};
|
||||
|
||||
|
||||
struct _ParasiteWidgetTreePrivate
|
||||
struct _GtkInspectorWidgetTreePrivate
|
||||
{
|
||||
GtkTreeStore *model;
|
||||
GHashTable *iters;
|
||||
@ -54,31 +54,31 @@ struct _ParasiteWidgetTreePrivate
|
||||
|
||||
static guint widget_tree_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ParasiteWidgetTree, parasite_widget_tree, GTK_TYPE_TREE_VIEW)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorWidgetTree, gtk_inspector_widget_tree, GTK_TYPE_TREE_VIEW)
|
||||
|
||||
static void
|
||||
on_widget_selected (GtkTreeSelection *selection,
|
||||
ParasiteWidgetTree *wt)
|
||||
on_widget_selected (GtkTreeSelection *selection,
|
||||
GtkInspectorWidgetTree *wt)
|
||||
{
|
||||
g_signal_emit (wt, widget_tree_signals[WIDGET_CHANGED], 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
parasite_widget_tree_init (ParasiteWidgetTree *wt)
|
||||
gtk_inspector_widget_tree_init (GtkInspectorWidgetTree *wt)
|
||||
{
|
||||
wt->priv = parasite_widget_tree_get_instance_private (wt);
|
||||
wt->priv = gtk_inspector_widget_tree_get_instance_private (wt);
|
||||
wt->priv->iters = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
(GDestroyNotify) gtk_tree_iter_free);
|
||||
gtk_widget_init_template (GTK_WIDGET (wt));
|
||||
|
||||
parasite_widget_tree_append_object (wt, G_OBJECT (gtk_settings_get_default ()), NULL);
|
||||
gtk_inspector_widget_tree_append_object (wt, G_OBJECT (gtk_settings_get_default ()), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_widget_tree_class_init (ParasiteWidgetTreeClass *klass)
|
||||
gtk_inspector_widget_tree_class_init (GtkInspectorWidgetTreeClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
@ -88,25 +88,25 @@ parasite_widget_tree_class_init (ParasiteWidgetTreeClass *klass)
|
||||
g_signal_new ("widget-changed",
|
||||
G_OBJECT_CLASS_TYPE(klass),
|
||||
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
||||
G_STRUCT_OFFSET(ParasiteWidgetTreeClass, widget_changed),
|
||||
G_STRUCT_OFFSET(GtkInspectorWidgetTreeClass, widget_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/widget-tree.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, ParasiteWidgetTree, model);
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/widget-tree.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorWidgetTree, model);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_widget_selected);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_widget_tree_new ()
|
||||
gtk_inspector_widget_tree_new (void)
|
||||
{
|
||||
return g_object_new (PARASITE_TYPE_WIDGET_TREE, NULL);
|
||||
return g_object_new (GTK_TYPE_INSPECTOR_WIDGET_TREE, NULL);
|
||||
}
|
||||
|
||||
|
||||
GObject *
|
||||
parasite_widget_tree_get_selected_object (ParasiteWidgetTree *wt)
|
||||
gtk_inspector_widget_tree_get_selected_object (GtkInspectorWidgetTree *wt)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeSelection *sel;
|
||||
@ -128,7 +128,7 @@ parasite_widget_tree_get_selected_object (ParasiteWidgetTree *wt)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ParasiteWidgetTree *wt;
|
||||
GtkInspectorWidgetTree *wt;
|
||||
GtkTreeIter *iter;
|
||||
} FindAllData;
|
||||
|
||||
@ -137,13 +137,13 @@ on_container_forall (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
FindAllData *d = data;
|
||||
parasite_widget_tree_append_object (d->wt, G_OBJECT (widget), d->iter);
|
||||
gtk_inspector_widget_tree_append_object (d->wt, G_OBJECT (widget), d->iter);
|
||||
}
|
||||
|
||||
void
|
||||
parasite_widget_tree_append_object (ParasiteWidgetTree *wt,
|
||||
GObject *object,
|
||||
GtkTreeIter *parent_iter)
|
||||
gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
|
||||
GObject *object,
|
||||
GtkTreeIter *parent_iter)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
const gchar *class_name = G_OBJECT_CLASS_NAME (G_OBJECT_GET_CLASS (object));
|
||||
@ -207,21 +207,21 @@ parasite_widget_tree_append_object (ParasiteWidgetTree *wt,
|
||||
}
|
||||
|
||||
void
|
||||
parasite_widget_tree_scan (ParasiteWidgetTree *wt,
|
||||
GtkWidget *window)
|
||||
gtk_inspector_widget_tree_scan (GtkInspectorWidgetTree *wt,
|
||||
GtkWidget *window)
|
||||
{
|
||||
gtk_tree_store_clear (wt->priv->model);
|
||||
g_hash_table_remove_all (wt->priv->iters);
|
||||
parasite_widget_tree_append_object (wt, G_OBJECT (gtk_settings_get_default ()), NULL);
|
||||
parasite_widget_tree_append_object (wt, G_OBJECT (window), NULL);
|
||||
gtk_inspector_widget_tree_append_object (wt, G_OBJECT (gtk_settings_get_default ()), NULL);
|
||||
gtk_inspector_widget_tree_append_object (wt, G_OBJECT (window), NULL);
|
||||
|
||||
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (wt));
|
||||
}
|
||||
|
||||
gboolean
|
||||
parasite_widget_tree_find_object (ParasiteWidgetTree *wt,
|
||||
GObject *object,
|
||||
GtkTreeIter *iter)
|
||||
gtk_inspector_widget_tree_find_object (GtkInspectorWidgetTree *wt,
|
||||
GObject *object,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeIter *internal_iter = g_hash_table_lookup (wt->priv->iters, object);
|
||||
if (internal_iter)
|
||||
@ -234,12 +234,12 @@ parasite_widget_tree_find_object (ParasiteWidgetTree *wt,
|
||||
}
|
||||
|
||||
void
|
||||
parasite_widget_tree_select_object (ParasiteWidgetTree *wt,
|
||||
GObject *object)
|
||||
gtk_inspector_widget_tree_select_object (GtkInspectorWidgetTree *wt,
|
||||
GObject *object)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (parasite_widget_tree_find_object (wt, object, &iter))
|
||||
if (gtk_inspector_widget_tree_find_object (wt, object, &iter))
|
||||
{
|
||||
GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL (wt->priv->model), &iter);
|
||||
gtk_tree_view_expand_to_path (GTK_TREE_VIEW (wt), path);
|
||||
|
@ -20,59 +20,59 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _GTKPARASITE_WIDGET_TREE_H_
|
||||
#define _GTKPARASITE_WIDGET_TREE_H_
|
||||
#ifndef _GTK_INSPECTOR_WIDGET_TREE_H_
|
||||
#define _GTK_INSPECTOR_WIDGET_TREE_H_
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
#define PARASITE_TYPE_WIDGET_TREE (parasite_widget_tree_get_type())
|
||||
#define PARASITE_WIDGET_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PARASITE_TYPE_WIDGET_TREE, ParasiteWidgetTree))
|
||||
#define PARASITE_WIDGET_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PARASITE_TYPE_WIDGET_TREE, ParasiteWidgetTreeClass))
|
||||
#define PARASITE_IS_WIDGET_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PARASITE_TYPE_WIDGET_TREE))
|
||||
#define PARASITE_IS_WIDGET_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PARASITE_TYPE_WIDGET_TREE))
|
||||
#define PARASITE_WIDGET_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PARASITE_TYPE_WIDGET_TREE, ParasiteWidgetTreeClass))
|
||||
#define GTK_TYPE_INSPECTOR_WIDGET_TREE (gtk_inspector_widget_tree_get_type())
|
||||
#define GTK_INSPECTOR_WIDGET_TREE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTree))
|
||||
#define GTK_INSPECTOR_WIDGET_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTreeClass))
|
||||
#define GTK_INSPECTOR_IS_WIDGET_TREE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE))
|
||||
#define GTK_INSPECTOR_IS_WIDGET_TREE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_WIDGET_TREE))
|
||||
#define GTK_INSPECTOR_WIDGET_TREE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_WIDGET_TREE, GtkInspectorWidgetTreeClass))
|
||||
|
||||
|
||||
typedef struct _ParasiteWidgetTreePrivate ParasiteWidgetTreePrivate;
|
||||
typedef struct _GtkInspectorWidgetTreePrivate GtkInspectorWidgetTreePrivate;
|
||||
|
||||
typedef struct _ParasiteWidgetTree
|
||||
typedef struct _GtkInspectorWidgetTree
|
||||
{
|
||||
GtkTreeView parent;
|
||||
ParasiteWidgetTreePrivate *priv;
|
||||
} ParasiteWidgetTree;
|
||||
GtkInspectorWidgetTreePrivate *priv;
|
||||
} GtkInspectorWidgetTree;
|
||||
|
||||
typedef struct _ParasiteWidgetTreeClass
|
||||
typedef struct _GtkInspectorWidgetTreeClass
|
||||
{
|
||||
GtkTreeViewClass parent;
|
||||
|
||||
void (*widget_changed) (ParasiteWidgetTree *tree);
|
||||
} ParasiteWidgetTreeClass;
|
||||
void (*widget_changed) (GtkInspectorWidgetTree *tree);
|
||||
} GtkInspectorWidgetTreeClass;
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
GType parasite_widget_tree_get_type (void);
|
||||
GtkWidget *parasite_widget_tree_new (void);
|
||||
GType gtk_inspector_widget_tree_get_type (void);
|
||||
GtkWidget *gtk_inspector_widget_tree_new (void);
|
||||
|
||||
GObject *parasite_widget_tree_get_selected_object (ParasiteWidgetTree *wt);
|
||||
GObject *gtk_inspector_widget_tree_get_selected_object (GtkInspectorWidgetTree *wt);
|
||||
|
||||
void parasite_widget_tree_scan (ParasiteWidgetTree *wt,
|
||||
GtkWidget *window);
|
||||
void parasite_widget_tree_select_object (ParasiteWidgetTree *wt,
|
||||
GObject *object);
|
||||
void parasite_widget_tree_append_object (ParasiteWidgetTree *wt,
|
||||
GObject *object,
|
||||
GtkTreeIter *parent_iter);
|
||||
gboolean parasite_widget_tree_find_object (ParasiteWidgetTree *wt,
|
||||
GObject *object,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_inspector_widget_tree_scan (GtkInspectorWidgetTree *wt,
|
||||
GtkWidget *window);
|
||||
void gtk_inspector_widget_tree_select_object (GtkInspectorWidgetTree *wt,
|
||||
GObject *object);
|
||||
void gtk_inspector_widget_tree_append_object (GtkInspectorWidgetTree *wt,
|
||||
GObject *object,
|
||||
GtkTreeIter *parent_iter);
|
||||
gboolean gtk_inspector_widget_tree_find_object (GtkInspectorWidgetTree *wt,
|
||||
GObject *object,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
#endif // _GTKPARASITE_WIDGETTREE_H_
|
||||
#endif // _GTK_INSPECTOR_WIDGETTREE_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -12,7 +12,7 @@
|
||||
<column type="gboolean"/>
|
||||
</columns>
|
||||
</object>
|
||||
<template class="ParasiteWidgetTree" parent="GtkTreeView">
|
||||
<template class="GtkInspectorWidgetTree" parent="GtkTreeView">
|
||||
<property name="model">model</property>
|
||||
<property name="enable-search">True</property>
|
||||
<property name="search-column">2</property>
|
||||
|
@ -35,118 +35,118 @@
|
||||
#include "button-path.h"
|
||||
#include "themes.h"
|
||||
|
||||
G_DEFINE_TYPE (ParasiteWindow, parasite_window, GTK_TYPE_WINDOW)
|
||||
G_DEFINE_TYPE (GtkInspectorWindow, gtk_inspector_window, GTK_TYPE_WINDOW)
|
||||
|
||||
extern void on_inspect (GtkWidget *button, ParasiteWindow *pw);
|
||||
extern void on_inspect (GtkWidget *button, GtkInspectorWindow *iw);
|
||||
|
||||
static void
|
||||
on_graphic_updates_toggled (GtkToggleButton *button,
|
||||
ParasiteWindow *parasite)
|
||||
on_graphic_updates_toggled (GtkToggleButton *button,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
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)
|
||||
on_widget_tree_button_press (GtkInspectorWidgetTree *wt,
|
||||
GdkEventButton *event,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
if (event->button == 3)
|
||||
gtk_menu_popup (GTK_MENU (parasite->widget_popup), NULL, NULL,
|
||||
gtk_menu_popup (GTK_MENU (iw->widget_popup), NULL, NULL,
|
||||
NULL, NULL, event->button, event->time);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_widget_tree_selection_changed (ParasiteWidgetTree *wt,
|
||||
ParasiteWindow *pw)
|
||||
on_widget_tree_selection_changed (GtkInspectorWidgetTree *wt,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
GObject *selected = parasite_widget_tree_get_selected_object (wt);
|
||||
GObject *selected = gtk_inspector_widget_tree_get_selected_object (wt);
|
||||
|
||||
if (selected != NULL)
|
||||
{
|
||||
if (!parasite_prop_list_set_object (PARASITE_PROP_LIST (pw->prop_list), selected))
|
||||
if (!gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->prop_list), selected))
|
||||
return;
|
||||
|
||||
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);
|
||||
gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected);
|
||||
gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected);
|
||||
|
||||
if (GTK_IS_WIDGET (selected))
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (selected);
|
||||
|
||||
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);
|
||||
gtk_inspector_flash_widget (iw, widget);
|
||||
gtk_inspector_button_path_set_widget (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), widget);
|
||||
gtk_inspector_classes_list_set_widget (GTK_INSPECTOR_CLASSES_LIST (iw->classes_list), widget);
|
||||
gtk_inspector_css_editor_set_widget (GTK_INSPECTOR_CSS_EDITOR (iw->widget_css_editor), widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive (pw->classes_list, FALSE);
|
||||
gtk_widget_set_sensitive (pw->widget_css_editor, FALSE);
|
||||
gtk_widget_set_sensitive (iw->classes_list, FALSE);
|
||||
gtk_widget_set_sensitive (iw->widget_css_editor, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_send_widget_to_shell_activate (GtkWidget *menuitem,
|
||||
ParasiteWindow *parasite)
|
||||
on_send_widget_to_shell_activate (GtkWidget *menuitem,
|
||||
GtkInspectorWindow *iw)
|
||||
{
|
||||
gchar *str;
|
||||
GObject *object;
|
||||
|
||||
object = parasite_widget_tree_get_selected_object (PARASITE_WIDGET_TREE (parasite->widget_tree));
|
||||
object = gtk_inspector_widget_tree_get_selected_object (GTK_INSPECTOR_WIDGET_TREE (iw->widget_tree));
|
||||
|
||||
if (!object)
|
||||
return;
|
||||
|
||||
str = g_strdup_printf ("parasite.gobj(%p)", object);
|
||||
parasite_python_shell_append_text (PARASITE_PYTHON_SHELL (parasite->python_shell),
|
||||
str = g_strdup_printf ("gtk_inspector.gobj(%p)", object);
|
||||
gtk_inspector_python_shell_append_text (GTK_INSPECTOR_PYTHON_SHELL (iw->python_shell),
|
||||
str,
|
||||
NULL);
|
||||
|
||||
g_free (str);
|
||||
parasite_python_shell_focus (PARASITE_PYTHON_SHELL (parasite->python_shell));
|
||||
gtk_inspector_python_shell_focus (GTK_INSPECTOR_PYTHON_SHELL (iw->python_shell));
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_window_init (ParasiteWindow *pw)
|
||||
gtk_inspector_window_init (GtkInspectorWindow *iw)
|
||||
{
|
||||
gchar *title;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (pw));
|
||||
gtk_widget_init_template (GTK_WIDGET (iw));
|
||||
|
||||
gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (pw));
|
||||
gtk_window_group_add_window (gtk_window_group_new (), GTK_WINDOW (iw));
|
||||
|
||||
title = g_strconcat ("Parasite - ", g_get_application_name (), NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (pw), title);
|
||||
title = g_strdup_printf ("GTK+ Inspector — %s", g_get_application_name ());
|
||||
gtk_window_set_title (GTK_WINDOW (iw), title);
|
||||
g_free (title);
|
||||
|
||||
if (parasite_python_is_enabled ())
|
||||
if (gtk_inspector_python_is_enabled ())
|
||||
{
|
||||
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);
|
||||
gtk_widget_show (iw->python_shell);
|
||||
g_signal_connect (G_OBJECT (iw->widget_tree), "button-press-event",
|
||||
G_CALLBACK (on_widget_tree_button_press), iw);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
parasite_window_class_init (ParasiteWindowClass *klass)
|
||||
gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/parasite/window.ui");
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/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_child (widget_class, GtkInspectorWindow, widget_tree);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, prop_list);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, child_prop_list);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, button_path);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, classes_list);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_css_editor);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_hierarchy);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, python_shell);
|
||||
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_popup);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_inspect);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_graphic_updates_toggled);
|
||||
@ -155,9 +155,9 @@ parasite_window_class_init (ParasiteWindowClass *klass)
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
parasite_window_new (void)
|
||||
gtk_inspector_window_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (PARASITE_TYPE_WINDOW, NULL));
|
||||
return GTK_WIDGET (g_object_new (GTK_TYPE_INSPECTOR_WINDOW, NULL));
|
||||
}
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -20,18 +20,18 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef _PARASITE_WINDOW_H_
|
||||
#define _PARASITE_WINDOW_H_
|
||||
#ifndef _GTK_INSPECTOR_WINDOW_H_
|
||||
#define _GTK_INSPECTOR_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 GTK_TYPE_INSPECTOR_WINDOW (gtk_inspector_window_get_type())
|
||||
#define GTK_INSPECTOR_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindow))
|
||||
#define GTK_INSPECTOR_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindowClass))
|
||||
#define GTK_INSPECTOR_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_WINDOW))
|
||||
#define GTK_INSPECTOR_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_WINDOW))
|
||||
#define GTK_INSPECTOR_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_WINDOW, GtkInspectorWindowClass))
|
||||
|
||||
|
||||
#define TREE_TEXT_SCALE 0.8
|
||||
@ -58,26 +58,27 @@ typedef struct
|
||||
gint flash_count;
|
||||
gint flash_cnx;
|
||||
|
||||
} ParasiteWindow;
|
||||
} GtkInspectorWindow;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWindowClass parent;
|
||||
} ParasiteWindowClass;
|
||||
} GtkInspectorWindowClass;
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType parasite_window_get_type (void);
|
||||
GtkWidget *parasite_window_new (void);
|
||||
GType gtk_inspector_window_get_type (void);
|
||||
GtkWidget *gtk_inspector_window_new (void);
|
||||
|
||||
void gtkparasite_flash_widget (ParasiteWindow *parasite,
|
||||
GtkWidget *widget);
|
||||
void gtk_inspector_flash_widget (GtkInspectorWindow *iw,
|
||||
GtkWidget *widget);
|
||||
|
||||
GtkWidget *gtkparasite_inspect_button_new (ParasiteWindow *parasite);
|
||||
GtkWidget *gtk_inspector_inspect_button_new (GtkInspectorWindow *iw);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif // _PARASITE_WINDOW_H_
|
||||
|
||||
#endif // _GTK_INSPECTOR_WINDOW_H_
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
@ -20,7 +20,7 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<template class="ParasiteWindow" parent="GtkWindow">
|
||||
<template class="GtkInspectorWindow" parent="GtkWindow">
|
||||
<property name="default-height">500</property>
|
||||
<property name="default-width">1000</property>
|
||||
<child type="titlebar">
|
||||
@ -65,7 +65,7 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="ParasiteButtonPath" id="button_path">
|
||||
<object class="GtkInspectorButtonPath" id="button_path">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -86,7 +86,7 @@
|
||||
<property name="width-request">250</property>
|
||||
<property name="expand">True</property>
|
||||
<child>
|
||||
<object class="ParasiteWidgetTree" id="widget_tree">
|
||||
<object class="GtkInspectorWidgetTree" id="widget_tree">
|
||||
<property name="visible">True</property>
|
||||
<signal name="widget-changed" handler="on_widget_tree_selection_changed"/>
|
||||
</object>
|
||||
@ -98,7 +98,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="ParasitePythonShell" id="python_shell">
|
||||
<object class="GtkInspectorPythonShell" id="python_shell">
|
||||
<property name="visible">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -125,7 +125,7 @@
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="width-request">250</property>
|
||||
<child>
|
||||
<object class="ParasitePropList" id="prop_list">
|
||||
<object class="GtkInspectorPropList" id="prop_list">
|
||||
<property name="visible">True</property>
|
||||
<property name="child-properties">False</property>
|
||||
</object>
|
||||
@ -146,7 +146,7 @@
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="width-request">250</property>
|
||||
<child>
|
||||
<object class="ParasitePropList" id="child_prop_list">
|
||||
<object class="GtkInspectorPropList" id="child_prop_list">
|
||||
<property name="visible">True</property>
|
||||
<property name="child-properties">True</property>
|
||||
</object>
|
||||
@ -160,7 +160,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="ParasiteObjectHierarchy" id="object_hierarchy">
|
||||
<object class="GtkInspectorObjectHierarchy" id="object_hierarchy">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -171,7 +171,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="ParasiteClassesList" id="classes_list">
|
||||
<object class="GtkInspectorClassesList" id="classes_list">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -182,7 +182,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="ParasiteCssEditor" id="widget_css_editor">
|
||||
<object class="GtkInspectorCssEditor" id="widget_css_editor">
|
||||
<property name="visible">True</property>
|
||||
<property name="global">False</property>
|
||||
</object>
|
||||
@ -210,7 +210,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="ParasiteThemes">
|
||||
<object class="GtkInspectorThemes">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -221,7 +221,7 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="ParasiteCssEditor">
|
||||
<object class="GtkInspectorCssEditor">
|
||||
<property name="visible">True</property>
|
||||
<property name="global">True</property>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user