[gnome-builder] colorpicker-prefs: add addin property
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] colorpicker-prefs: add addin property
- Date: Wed, 20 Jul 2016 10:34:03 +0000 (UTC)
commit 4e93b0a748befc5e4a3f9d2d6ea40725b7e9a84a
Author: Sebastien Lafargue <slafargue gnome org>
Date: Wed Jul 20 11:44:29 2016 +0200
colorpicker-prefs: add addin property
We need to acces the GbColorPickerWorkbenchAddin
and its fields from colorpicker prefs
plugins/color-picker/Makefile.am | 35 ++++++++--------
plugins/color-picker/gb-color-picker-prefs.c | 19 ++++++++
.../gb-color-picker-workbench-addin-private.h | 44 ++++++++++++++++++++
.../color-picker/gb-color-picker-workbench-addin.c | 18 +-------
4 files changed, 83 insertions(+), 33 deletions(-)
---
diff --git a/plugins/color-picker/Makefile.am b/plugins/color-picker/Makefile.am
index d4de2bb..b455e7b 100644
--- a/plugins/color-picker/Makefile.am
+++ b/plugins/color-picker/Makefile.am
@@ -9,23 +9,24 @@ plugindir = $(libdir)/gnome-builder/plugins
plugin_LTLIBRARIES = libcolor-picker-plugin.la
dist_plugin_DATA = color-picker.plugin
-libcolor_picker_plugin_la_SOURCES = \
- gb-color-picker-helper.c \
- gb-color-picker-helper.h \
- gb-color-picker-plugin.c \
- gb-color-picker-document-monitor.c \
- gb-color-picker-document-monitor.h \
- gb-color-picker-prefs.c \
- gb-color-picker-prefs.h \
- gb-color-picker-prefs-list.c \
- gb-color-picker-prefs-palette-list.h \
- gb-color-picker-prefs-palette-list.c \
- gb-color-picker-prefs-list.h \
- gb-color-picker-prefs-palette-row.c \
- gb-color-picker-prefs-palette-row.h \
- gb-color-picker-private.h \
- gb-color-picker-workbench-addin.c \
- gb-color-picker-workbench-addin.h \
+libcolor_picker_plugin_la_SOURCES = \
+ gb-color-picker-helper.c \
+ gb-color-picker-helper.h \
+ gb-color-picker-plugin.c \
+ gb-color-picker-document-monitor.c \
+ gb-color-picker-document-monitor.h \
+ gb-color-picker-prefs.c \
+ gb-color-picker-prefs.h \
+ gb-color-picker-prefs-list.c \
+ gb-color-picker-prefs-palette-list.h \
+ gb-color-picker-prefs-palette-list.c \
+ gb-color-picker-prefs-list.h \
+ gb-color-picker-prefs-palette-row.c \
+ gb-color-picker-prefs-palette-row.h \
+ gb-color-picker-private.h \
+ gb-color-picker-workbench-addin.c \
+ gb-color-picker-workbench-addin.h \
+ gb-color-picker-workbench-addin-private.h \
$(NULL)
libcolor_picker_plugin_la_includes = \
diff --git a/plugins/color-picker/gb-color-picker-prefs.c b/plugins/color-picker/gb-color-picker-prefs.c
index 4822c87..f564e20 100644
--- a/plugins/color-picker/gb-color-picker-prefs.c
+++ b/plugins/color-picker/gb-color-picker-prefs.c
@@ -25,6 +25,8 @@
#include "gb-color-picker-prefs-list.h"
#include "gb-color-picker-prefs-palette-list.h"
#include "gb-color-picker-prefs-palette-row.h"
+#include "gb-color-picker-workbench-addin.h"
+#include "gb-color-picker-workbench-addin-private.h"
struct _GbColorPickerPrefs
{
@@ -36,6 +38,7 @@ struct _GbColorPickerPrefs
GtkWidget *palettes_list_page;
GstyleColorPanel *panel;
+ GbColorPickerWorkbenchAddin *addin;
GstylePaletteWidget *palette_widget;
GListStore *palettes_store;
GbColorPickerPrefsPaletteList *palettes_box;
@@ -62,6 +65,7 @@ G_DEFINE_TYPE (GbColorPickerPrefs, gb_color_picker_prefs, G_TYPE_OBJECT)
enum
{
PROP_0,
+ PROP_ADDIN,
PROP_PANEL,
N_PROPS
};
@@ -494,6 +498,10 @@ gb_color_picker_prefs_get_property (GObject *object,
switch (prop_id)
{
+ case PROP_ADDIN:
+ g_value_set_object (value, self->addin);
+ break;
+
case PROP_PANEL:
g_value_set_object (value, gb_color_picker_prefs_get_panel (self));
break;
@@ -513,6 +521,10 @@ gb_color_picker_prefs_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_ADDIN:
+ self->addin = g_value_get_object (value);
+ break;
+
case PROP_PANEL:
gb_color_picker_prefs_set_panel (self, g_value_get_object (value));
break;
@@ -562,6 +574,13 @@ gb_color_picker_prefs_class_init (GbColorPickerPrefsClass *klass)
GSTYLE_TYPE_COLOR_PANEL,
(G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
+ properties [PROP_ADDIN] =
+ g_param_spec_object ("addin",
+ "addin",
+ "Colorpicker worbench addin",
+ GB_TYPE_COLOR_PICKER_WORKBENCH_ADDIN,
+ (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
+
g_object_class_install_properties (object_class, N_PROPS, properties);
}
diff --git a/plugins/color-picker/gb-color-picker-workbench-addin-private.h
b/plugins/color-picker/gb-color-picker-workbench-addin-private.h
new file mode 100644
index 0000000..96e1387
--- /dev/null
+++ b/plugins/color-picker/gb-color-picker-workbench-addin-private.h
@@ -0,0 +1,44 @@
+/* gb-color-picker-workbench-addin-private.h
+ *
+ * Copyright (C) 2016 Sebastien Lafargue <slafargue gnome org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GB_COLOR_PICKER_WORKBENCH_ADDIN_PRIVATE_H
+#define GB_COLOR_PICKER_WORKBENCH_ADDIN_PRIVATE_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+struct _GbColorPickerWorkbenchAddin
+{
+ GObject parent_instance;
+
+ GHashTable *views;
+ IdeWorkbench *workbench;
+ IdeEditorPerspective *editor;
+ GtkWidget *active_view;
+ GtkWidget *dock;
+ GtkWidget *color_panel;
+ GbColorPickerPrefs *prefs;
+
+ guint dock_count;
+ guint monitor_count;
+};
+
+G_END_DECLS
+
+#endif /* GB_COLOR_PICKER_WORKBENCH_ADDIN_PRIVATE_H */
diff --git a/plugins/color-picker/gb-color-picker-workbench-addin.c
b/plugins/color-picker/gb-color-picker-workbench-addin.c
index dcb2260..300f807 100644
--- a/plugins/color-picker/gb-color-picker-workbench-addin.c
+++ b/plugins/color-picker/gb-color-picker-workbench-addin.c
@@ -30,6 +30,7 @@
#include "gb-color-picker-prefs.h"
#include "gb-color-picker-workbench-addin.h"
+#include "gb-color-picker-workbench-addin-private.h"
typedef struct __ViewState
{
@@ -37,22 +38,6 @@ typedef struct __ViewState
GbColorPickerDocumentMonitor *monitor;
} ViewState;
-struct _GbColorPickerWorkbenchAddin
-{
- GObject parent_instance;
-
- GHashTable *views;
- IdeWorkbench *workbench;
- IdeEditorPerspective *editor;
- GtkWidget *active_view;
- GtkWidget *dock;
- GtkWidget *color_panel;
- GbColorPickerPrefs *prefs;
-
- guint dock_count;
- guint monitor_count;
-};
-
static void workbench_addin_iface_init (IdeWorkbenchAddinInterface *iface);
G_DEFINE_TYPE_EXTENDED (GbColorPickerWorkbenchAddin, gb_color_picker_workbench_addin, G_TYPE_OBJECT, 0,
@@ -200,6 +185,7 @@ init_dock (GbColorPickerWorkbenchAddin *self)
self->prefs = g_object_new (GB_TYPE_COLOR_PICKER_PREFS,
"panel", self->color_panel,
+ "addin", self,
NULL);
init_palettes (self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]