[gimp] app: cleanup, code reordring and cruft removal in GimpDockable
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: cleanup, code reordring and cruft removal in GimpDockable
- Date: Thu, 7 Jun 2018 23:54:49 +0000 (UTC)
commit dd8f5acd9b197a10b05f7dd3abdd95f169dd8039
Author: Michael Natterer <mitch gimp org>
Date: Fri Jun 8 01:53:46 2018 +0200
app: cleanup, code reordring and cruft removal in GimpDockable
app/actions/dockable-actions.c | 2 +-
app/actions/dockable-commands.c | 2 +-
app/widgets/gimpdockable.c | 137 +++++++++++++++++-----------------------
app/widgets/gimpdockable.h | 72 +++++++++++----------
app/widgets/gimpdockbook.c | 4 +-
5 files changed, 100 insertions(+), 117 deletions(-)
---
diff --git a/app/actions/dockable-actions.c b/app/actions/dockable-actions.c
index 260223a865..347d7e33d9 100644
--- a/app/actions/dockable-actions.c
+++ b/app/actions/dockable-actions.c
@@ -281,7 +281,7 @@ dockable_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0)
- locked = gimp_dockable_is_locked (dockable);
+ locked = gimp_dockable_get_locked (dockable);
SET_SENSITIVE ("dockable-detach-tab", (! locked &&
(n_pages > 1 || n_books > 1)));
diff --git a/app/actions/dockable-commands.c b/app/actions/dockable-commands.c
index b8bf69d683..a257470157 100644
--- a/app/actions/dockable-commands.c
+++ b/app/actions/dockable-commands.c
@@ -177,7 +177,7 @@ dockable_toggle_view_cmd_callback (GtkAction *action,
gboolean show;
gimp_dockable_set_locked (GIMP_DOCKABLE (new_dockable),
- gimp_dockable_is_locked (dockable));
+ gimp_dockable_get_locked (dockable));
old = GIMP_DOCKED (gtk_bin_get_child (GTK_BIN (dockable)));
new = GIMP_DOCKED (gtk_bin_get_child (GTK_BIN (new_dockable)));
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index 6587a21f5f..cd9529f441 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -70,32 +70,27 @@ struct _GimpDockablePrivate
};
-static void gimp_dockable_session_managed_iface_init
- (GimpSessionManagedInterface
- *iface);
-static void gimp_dockable_dispose (GObject *object);
-static void gimp_dockable_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_dockable_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void gimp_dockable_style_updated (GtkWidget *widget);
-
-static void gimp_dockable_add (GtkContainer *container,
- GtkWidget *widget);
-static GType gimp_dockable_child_type (GtkContainer *container);
-static GList * gimp_dockable_get_aux_info (GimpSessionManaged
- *session_managed);
-static void gimp_dockable_set_aux_info (GimpSessionManaged
- *session_managed,
- GList *aux_info);
-static GimpTabStyle
- gimp_dockable_convert_tab_style (GimpDockable *dockable,
- GimpTabStyle tab_style);
+static void gimp_dockable_session_managed_iface_init (GimpSessionManagedInterface *iface);
+
+static void gimp_dockable_dispose (GObject *object);
+static void gimp_dockable_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_dockable_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_dockable_style_updated (GtkWidget *widget);
+
+static void gimp_dockable_add (GtkContainer *container,
+ GtkWidget *widget);
+static GType gimp_dockable_child_type (GtkContainer *container);
+
+static GList * gimp_dockable_get_aux_info (GimpSessionManaged *managed);
+static void gimp_dockable_set_aux_info (GimpSessionManaged *managed,
+ GList *aux_info);
G_DEFINE_TYPE_WITH_CODE (GimpDockable, gimp_dockable, GTK_TYPE_BIN,
@@ -416,6 +411,22 @@ gimp_dockable_get_dockbook (GimpDockable *dockable)
return dockable->p->dockbook;
}
+void
+gimp_dockable_set_tab_style (GimpDockable *dockable,
+ GimpTabStyle tab_style)
+{
+ GtkWidget *child;
+
+ g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
+
+ child = gtk_bin_get_child (GTK_BIN (dockable));
+
+ if (child && ! GIMP_DOCKED_GET_INTERFACE (child)->get_preview)
+ tab_style = gimp_preview_tab_style_to_icon (tab_style);
+
+ dockable->p->tab_style = tab_style;
+}
+
GimpTabStyle
gimp_dockable_get_tab_style (GimpDockable *dockable)
{
@@ -424,6 +435,28 @@ gimp_dockable_get_tab_style (GimpDockable *dockable)
return dockable->p->tab_style;
}
+void
+gimp_dockable_set_locked (GimpDockable *dockable,
+ gboolean lock)
+{
+ g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
+
+ if (dockable->p->locked != lock)
+ {
+ dockable->p->locked = lock ? TRUE : FALSE;
+
+ g_object_notify (G_OBJECT (dockable), "locked");
+ }
+}
+
+gboolean
+gimp_dockable_get_locked (GimpDockable *dockable)
+{
+ g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), FALSE);
+
+ return dockable->p->locked;
+}
+
const gchar *
gimp_dockable_get_name (GimpDockable *dockable)
{
@@ -465,46 +498,6 @@ gimp_dockable_get_icon (GimpDockable *dockable,
return gtk_image_new_from_icon_name (dockable->p->icon_name, size);
}
-gboolean
-gimp_dockable_get_locked (GimpDockable *dockable)
-{
- g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), FALSE);
-
- return dockable->p->locked;
-}
-
-void
-gimp_dockable_set_locked (GimpDockable *dockable,
- gboolean lock)
-{
- g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
-
- if (dockable->p->locked != lock)
- {
- dockable->p->locked = lock ? TRUE : FALSE;
-
- g_object_notify (G_OBJECT (dockable), "locked");
- }
-}
-
-gboolean
-gimp_dockable_is_locked (GimpDockable *dockable)
-{
- g_return_val_if_fail (GIMP_IS_DOCKABLE (dockable), FALSE);
-
- return dockable->p->locked;
-}
-
-
-void
-gimp_dockable_set_tab_style (GimpDockable *dockable,
- GimpTabStyle tab_style)
-{
- g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
-
- dockable->p->tab_style = gimp_dockable_convert_tab_style (dockable, tab_style);
-}
-
GtkWidget *
gimp_dockable_create_tab_widget (GimpDockable *dockable,
GimpContext *context,
@@ -635,15 +628,3 @@ gimp_dockable_set_aux_info (GimpSessionManaged *session_managed,
if (child)
gimp_docked_set_aux_info (GIMP_DOCKED (child), aux_info);
}
-
-static GimpTabStyle
-gimp_dockable_convert_tab_style (GimpDockable *dockable,
- GimpTabStyle tab_style)
-{
- GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));
-
- if (child && ! GIMP_DOCKED_GET_INTERFACE (child)->get_preview)
- tab_style = gimp_preview_tab_style_to_icon (tab_style);
-
- return tab_style;
-}
diff --git a/app/widgets/gimpdockable.h b/app/widgets/gimpdockable.h
index 4b754dc308..41238f8bd6 100644
--- a/app/widgets/gimpdockable.h
+++ b/app/widgets/gimpdockable.h
@@ -56,41 +56,43 @@ struct _GimpDockableClass
};
-GType gimp_dockable_get_type (void) G_GNUC_CONST;
-
-GtkWidget * gimp_dockable_new (const gchar *name,
- const gchar *blurb,
- const gchar *icon_name,
- const gchar *help_id);
-void gimp_dockable_set_dockbook (GimpDockable *dockable,
- GimpDockbook *dockbook);
-GimpDockbook * gimp_dockable_get_dockbook (GimpDockable *dockable);
-GimpTabStyle gimp_dockable_get_tab_style (GimpDockable *dockable);
-const gchar * gimp_dockable_get_name (GimpDockable *dockable);
-const gchar * gimp_dockable_get_blurb (GimpDockable *dockable);
-const gchar * gimp_dockable_get_help_id (GimpDockable *dockable);
-const gchar * gimp_dockable_get_icon_name (GimpDockable *dockable);
-GtkWidget * gimp_dockable_get_icon (GimpDockable *dockable,
- GtkIconSize size);
-
-gboolean gimp_dockable_get_locked (GimpDockable *dockable);
-void gimp_dockable_set_locked (GimpDockable *dockable,
- gboolean lock);
-gboolean gimp_dockable_is_locked (GimpDockable *dockable);
-
-void gimp_dockable_set_tab_style (GimpDockable *dockable,
- GimpTabStyle tab_style);
-GtkWidget * gimp_dockable_create_tab_widget (GimpDockable *dockable,
- GimpContext *context,
- GimpTabStyle tab_style,
- GtkIconSize size);
-void gimp_dockable_set_context (GimpDockable *dockable,
- GimpContext *context);
-GimpUIManager * gimp_dockable_get_menu (GimpDockable *dockable,
- const gchar **ui_path,
- gpointer *popup_data);
-
-void gimp_dockable_detach (GimpDockable *dockable);
+GType gimp_dockable_get_type (void) G_GNUC_CONST;
+
+GtkWidget * gimp_dockable_new (const gchar *name,
+ const gchar *blurb,
+ const gchar *icon_name,
+ const gchar *help_id);
+
+void gimp_dockable_set_dockbook (GimpDockable *dockable,
+ GimpDockbook *dockbook);
+GimpDockbook * gimp_dockable_get_dockbook (GimpDockable *dockable);
+
+void gimp_dockable_set_tab_style (GimpDockable *dockable,
+ GimpTabStyle tab_style);
+GimpTabStyle gimp_dockable_get_tab_style (GimpDockable *dockable);
+
+void gimp_dockable_set_locked (GimpDockable *dockable,
+ gboolean lock);
+gboolean gimp_dockable_get_locked (GimpDockable *dockable);
+
+const gchar * gimp_dockable_get_name (GimpDockable *dockable);
+const gchar * gimp_dockable_get_blurb (GimpDockable *dockable);
+const gchar * gimp_dockable_get_help_id (GimpDockable *dockable);
+const gchar * gimp_dockable_get_icon_name (GimpDockable *dockable);
+GtkWidget * gimp_dockable_get_icon (GimpDockable *dockable,
+ GtkIconSize size);
+
+GtkWidget * gimp_dockable_create_tab_widget (GimpDockable *dockable,
+ GimpContext *context,
+ GimpTabStyle tab_style,
+ GtkIconSize size);
+void gimp_dockable_set_context (GimpDockable *dockable,
+ GimpContext *context);
+GimpUIManager * gimp_dockable_get_menu (GimpDockable *dockable,
+ const gchar **ui_path,
+ gpointer *popup_data);
+
+void gimp_dockable_detach (GimpDockable *dockable);
#endif /* __GIMP_DOCKABLE_H__ */
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index bb7212c79e..b2af18c818 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -415,7 +415,7 @@ gimp_dockbook_page_added (GtkNotebook *notebook,
gtk_notebook_set_tab_label (notebook, child, tab_widget);
gtk_notebook_set_menu_label (notebook, child, menu_widget);
- if (! gimp_dockable_is_locked (dockable))
+ if (! gimp_dockable_get_locked (dockable))
{
gtk_notebook_set_tab_reorderable (notebook, child, TRUE);
gtk_notebook_set_tab_detachable (notebook, child, TRUE);
@@ -905,7 +905,7 @@ gimp_dockbook_tab_locked_notify (GimpDockable *dockable,
GParamSpec *pspec,
GimpDockbook *dockbook)
{
- gboolean locked = gimp_dockable_is_locked (dockable);
+ gboolean locked = gimp_dockable_get_locked (dockable);
gtk_notebook_set_tab_reorderable (GTK_NOTEBOOK (dockbook),
GTK_WIDGET (dockable), ! locked);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]