inspector: Rename "Gestures" page to "Controllers"

And rename GtkInspectorGestures => GtkInspectorControllers, too.
This commit is contained in:
Benjamin Otte 2018-09-11 02:25:37 +02:00
parent 59006e2e03
commit 5e8983883e
8 changed files with 89 additions and 87 deletions

View File

@ -18,7 +18,7 @@
#include "config.h"
#include <glib/gi18n-lib.h>
#include "gestures.h"
#include "controllers.h"
#include "object-tree.h"
#include "gtksizegroup.h"
@ -35,32 +35,32 @@ enum
PROP_OBJECT_TREE
};
struct _GtkInspectorGesturesPrivate
struct _GtkInspectorControllersPrivate
{
GtkWidget *listbox;
GtkSizeGroup *sizegroup;
GtkInspectorObjectTree *object_tree;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorGestures, gtk_inspector_gestures, GTK_TYPE_BOX)
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorControllers, gtk_inspector_controllers, GTK_TYPE_BOX)
static void
row_activated (GtkListBox *box,
GtkListBoxRow *row,
GtkInspectorGestures *sl)
row_activated (GtkListBox *box,
GtkListBoxRow *row,
GtkInspectorControllers *sl)
{
GObject *gesture;
GObject *controller;
gesture = G_OBJECT (g_object_get_data (G_OBJECT (row), "gesture"));
gtk_inspector_object_tree_select_object (sl->priv->object_tree, gesture);
controller = G_OBJECT (g_object_get_data (G_OBJECT (row), "controller"));
gtk_inspector_object_tree_select_object (sl->priv->object_tree, controller);
}
static void
gtk_inspector_gestures_init (GtkInspectorGestures *sl)
gtk_inspector_controllers_init (GtkInspectorControllers *sl)
{
GtkWidget *frame;
sl->priv = gtk_inspector_gestures_get_instance_private (sl);
sl->priv = gtk_inspector_controllers_get_instance_private (sl);
sl->priv->sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
g_object_set (sl,
"orientation", GTK_ORIENTATION_VERTICAL,
@ -85,7 +85,7 @@ gtk_inspector_gestures_init (GtkInspectorGestures *sl)
}
static void
clear_all (GtkInspectorGestures *sl)
clear_all (GtkInspectorControllers *sl)
{
GList *children, *l;
GtkWidget *child;
@ -100,7 +100,8 @@ clear_all (GtkInspectorGestures *sl)
}
static void
phase_changed_cb (GtkComboBox *combo, GtkInspectorGestures *sl)
phase_changed_cb (GtkComboBox *combo,
GtkInspectorControllers *sl)
{
GtkWidget *row;
GtkPropagationPhase phase;
@ -108,14 +109,14 @@ phase_changed_cb (GtkComboBox *combo, GtkInspectorGestures *sl)
phase = gtk_combo_box_get_active (combo);
row = gtk_widget_get_ancestor (GTK_WIDGET (combo), GTK_TYPE_LIST_BOX_ROW);
controller = GTK_EVENT_CONTROLLER (g_object_get_data (G_OBJECT (row), "gesture"));
controller = GTK_EVENT_CONTROLLER (g_object_get_data (G_OBJECT (row), "controller"));
gtk_event_controller_set_propagation_phase (controller, phase);
}
static void
add_controller (GtkInspectorGestures *sl,
GObject *object,
GtkEventController *controller)
add_controller (GtkInspectorControllers *sl,
GObject *object,
GtkEventController *controller)
{
GtkWidget *row;
GtkWidget *box;
@ -147,13 +148,13 @@ add_controller (GtkInspectorGestures *sl,
gtk_widget_set_halign (label, GTK_ALIGN_END);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
g_object_set_data (G_OBJECT (row), "gesture", controller);
g_object_set_data (G_OBJECT (row), "controller", controller);
g_signal_connect (combo, "changed", G_CALLBACK (phase_changed_cb), sl);
}
void
gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
GObject *object)
gtk_inspector_controllers_set_object (GtkInspectorControllers *sl,
GObject *object)
{
GtkPropagationPhase phase;
GList *list, *l;
@ -180,7 +181,7 @@ get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GtkInspectorGestures *sl = GTK_INSPECTOR_GESTURES (object);
GtkInspectorControllers *sl = GTK_INSPECTOR_CONTROLLERS (object);
switch (param_id)
{
@ -200,7 +201,7 @@ set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
GtkInspectorGestures *sl = GTK_INSPECTOR_GESTURES (object);
GtkInspectorControllers *sl = GTK_INSPECTOR_CONTROLLERS (object);
switch (param_id)
{
@ -215,7 +216,7 @@ set_property (GObject *object,
}
static void
gtk_inspector_gestures_class_init (GtkInspectorGesturesClass *klass)
gtk_inspector_controllers_class_init (GtkInspectorControllersClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GTK_INSPECTOR_CONTROLLERS_H_
#define _GTK_INSPECTOR_CONTROLLERS_H_
#include <gtk/gtkbox.h>
#define GTK_TYPE_INSPECTOR_CONTROLLERS (gtk_inspector_controllers_get_type())
#define GTK_INSPECTOR_CONTROLLERS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_CONTROLLERS, GtkInspectorControllers))
#define GTK_INSPECTOR_CONTROLLERS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_CONTROLLERS, GtkInspectorControllersClass))
#define GTK_INSPECTOR_IS_GESTURES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_CONTROLLERS))
#define GTK_INSPECTOR_IS_GESTURES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_CONTROLLERS))
#define GTK_INSPECTOR_CONTROLLERS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_CONTROLLERS, GtkInspectorControllersClass))
typedef struct _GtkInspectorControllersPrivate GtkInspectorControllersPrivate;
typedef struct _GtkInspectorControllers
{
GtkBox parent;
GtkInspectorControllersPrivate *priv;
} GtkInspectorControllers;
typedef struct _GtkInspectorControllersClass
{
GtkBoxClass parent;
} GtkInspectorControllersClass;
G_BEGIN_DECLS
GType gtk_inspector_controllers_get_type (void);
void gtk_inspector_controllers_set_object (GtkInspectorControllers *sl,
GObject *object);
G_END_DECLS
#endif // _GTK_INSPECTOR_CONTROLLERS_H_
// vim: set et sw=2 ts=2:

View File

@ -1,54 +0,0 @@
/*
* Copyright (c) 2014 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _GTK_INSPECTOR_GESTURES_H_
#define _GTK_INSPECTOR_GESTURES_H_
#include <gtk/gtkbox.h>
#define GTK_TYPE_INSPECTOR_GESTURES (gtk_inspector_gestures_get_type())
#define GTK_INSPECTOR_GESTURES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_INSPECTOR_GESTURES, GtkInspectorGestures))
#define GTK_INSPECTOR_GESTURES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_INSPECTOR_GESTURES, GtkInspectorGesturesClass))
#define GTK_INSPECTOR_IS_GESTURES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_INSPECTOR_GESTURES))
#define GTK_INSPECTOR_IS_GESTURES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_INSPECTOR_GESTURES))
#define GTK_INSPECTOR_GESTURES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_INSPECTOR_GESTURES, GtkInspectorGesturesClass))
typedef struct _GtkInspectorGesturesPrivate GtkInspectorGesturesPrivate;
typedef struct _GtkInspectorGestures
{
GtkBox parent;
GtkInspectorGesturesPrivate *priv;
} GtkInspectorGestures;
typedef struct _GtkInspectorGesturesClass
{
GtkBoxClass parent;
} GtkInspectorGesturesClass;
G_BEGIN_DECLS
GType gtk_inspector_gestures_get_type (void);
void gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
GObject *object);
G_END_DECLS
#endif // _GTK_INSPECTOR_GESTURES_H_
// vim: set et sw=2 ts=2:

View File

@ -26,11 +26,11 @@
#include "actions.h"
#include "cellrenderergraph.h"
#include "controllers.h"
#include "css-editor.h"
#include "css-node-tree.h"
#include "data-list.h"
#include "general.h"
#include "gestures.h"
#include "graphdata.h"
#include "logs.h"
#include "magnifier.h"
@ -63,11 +63,11 @@ gtk_inspector_init (void)
g_type_ensure (GTK_TYPE_CELL_RENDERER_GRAPH);
g_type_ensure (GTK_TYPE_GRAPH_DATA);
g_type_ensure (GTK_TYPE_INSPECTOR_ACTIONS);
g_type_ensure (GTK_TYPE_INSPECTOR_CONTROLLERS);
g_type_ensure (GTK_TYPE_INSPECTOR_CSS_EDITOR);
g_type_ensure (GTK_TYPE_INSPECTOR_CSS_NODE_TREE);
g_type_ensure (GTK_TYPE_INSPECTOR_DATA_LIST);
g_type_ensure (GTK_TYPE_INSPECTOR_GENERAL);
g_type_ensure (GTK_TYPE_INSPECTOR_GESTURES);
g_type_ensure (GTK_TYPE_INSPECTOR_LOGS);
g_type_ensure (GTK_TYPE_MAGNIFIER);
g_type_ensure (GTK_TYPE_INSPECTOR_MAGNIFIER);

View File

@ -2,12 +2,12 @@ inspector_sources = files(
'action-editor.c',
'actions.c',
'cellrenderergraph.c',
'controllers.c',
'css-editor.c',
'css-node-tree.c',
'data-list.c',
'fpsoverlay.c',
'general.c',
'gestures.c',
'graphdata.c',
'gtkstackcombo.c',
'gtktreemodelcssnode.c',

View File

@ -29,6 +29,7 @@
#include "window.h"
#include "prop-list.h"
#include "controllers.h"
#include "css-editor.h"
#include "css-node-tree.h"
#include "object-hierarchy.h"
@ -40,7 +41,6 @@
#include "actions.h"
#include "menu.h"
#include "misc-info.h"
#include "gestures.h"
#include "magnifier.h"
#include "recorder.h"
@ -81,7 +81,7 @@ set_selected_object (GtkInspectorWindow *iw,
gtk_inspector_data_list_set_object (GTK_INSPECTOR_DATA_LIST (iw->data_list), selected);
gtk_inspector_actions_set_object (GTK_INSPECTOR_ACTIONS (iw->actions), selected);
gtk_inspector_menu_set_object (GTK_INSPECTOR_MENU (iw->menu), selected);
gtk_inspector_gestures_set_object (GTK_INSPECTOR_GESTURES (iw->gestures), selected);
gtk_inspector_controllers_set_object (GTK_INSPECTOR_CONTROLLERS (iw->controllers), selected);
gtk_inspector_magnifier_set_object (GTK_INSPECTOR_MAGNIFIER (iw->magnifier), selected);
for (l = iw->extra_pages; l != NULL; l = l->next)
@ -287,7 +287,7 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, actions);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, menu);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, misc_info);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, gestures);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, controllers);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, magnifier);
gtk_widget_class_bind_template_callback (widget_class, gtk_inspector_on_inspect);

View File

@ -69,7 +69,7 @@ typedef struct
GtkWidget *actions;
GtkWidget *menu;
GtkWidget *misc_info;
GtkWidget *gestures;
GtkWidget *controllers;
GtkWidget *magnifier;
GtkWidget *invisible;

View File

@ -365,12 +365,12 @@
</packing>
</child>
<child>
<object class="GtkInspectorGestures" id="gestures">
<object class="GtkInspectorControllers" id="controllers">
<property name="object-tree">object_tree</property>
</object>
<packing>
<property name="name">gestures</property>
<property name="title" translatable="yes">Gestures</property>
<property name="name">controllers</property>
<property name="title" translatable="yes">Controllers</property>
</packing>
</child>
<child>