[gnome-builder: 68/139] color-picker: port to libide-editor
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder: 68/139] color-picker: port to libide-editor
- Date: Thu, 10 Jan 2019 04:23:02 +0000 (UTC)
commit e99b7c117aaa3cd926c20932d2de27a339e92726
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 9 17:09:45 2019 -0800
color-picker: port to libide-editor
This ports the color-picker plugin to use our new naming in libide-editor
to keep things more consistent across the code base and UI.
...er.gresource.xml => color-picker.gresource.xml} | 18 +++--
src/plugins/color-picker/color-picker.plugin | 10 +--
.../gb-color-picker-document-monitor.c | 6 +-
.../gb-color-picker-document-monitor.h | 2 +-
.../color-picker/gb-color-picker-editor-addin.c | 80 +++++++++++-----------
.../color-picker/gb-color-picker-editor-addin.h | 2 +-
...addin.c => gb-color-picker-editor-page-addin.c} | 78 ++++++++++-----------
...addin.h => gb-color-picker-editor-page-addin.h} | 14 ++--
src/plugins/color-picker/gb-color-picker-helper.c | 2 +-
src/plugins/color-picker/gb-color-picker-plugin.c | 14 ++--
.../gb-color-picker-prefs-palette-row.c | 6 +-
src/plugins/color-picker/gb-color-picker-prefs.c | 10 +--
src/plugins/color-picker/meson.build | 41 ++++-------
src/plugins/color-picker/themes/Adwaita-dark.css | 2 +-
src/plugins/color-picker/themes/Adwaita.css | 2 +-
15 files changed, 138 insertions(+), 149 deletions(-)
---
diff --git a/src/plugins/color-picker/gb-color-picker.gresource.xml
b/src/plugins/color-picker/color-picker.gresource.xml
similarity index 64%
rename from src/plugins/color-picker/gb-color-picker.gresource.xml
rename to src/plugins/color-picker/color-picker.gresource.xml
index c2139dfb8..477648936 100644
--- a/src/plugins/color-picker/gb-color-picker.gresource.xml
+++ b/src/plugins/color-picker/color-picker.gresource.xml
@@ -1,22 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gnome/builder/plugins">
+ <gresource prefix="/plugins/color-picker">
<file>color-picker.plugin</file>
- </gresource>
- <gresource prefix="/org/gnome/builder/plugins/color-picker-plugin">
<file>themes/Adwaita.css</file>
<file>themes/Adwaita-dark.css</file>
<file>themes/shared.css</file>
- <file>gtk/color-picker.ui</file>
- <file>gtk/color-picker-prefs.ui</file>
- <file>gtk/color-picker-preview.ui</file>
- <file>gtk/color-picker-palette-row.ui</file>
- <file>gtk/color-picker-palette-menu.ui</file>
- <file>gtk/menus.ui</file>
+ <file preprocess="xml-stripblanks">gtk/color-picker.ui</file>
+ <file preprocess="xml-stripblanks">gtk/color-picker-prefs.ui</file>
+ <file preprocess="xml-stripblanks">gtk/color-picker-preview.ui</file>
+ <file preprocess="xml-stripblanks">gtk/color-picker-palette-row.ui</file>
+ <file preprocess="xml-stripblanks">gtk/color-picker-palette-menu.ui</file>
+ <file preprocess="xml-stripblanks">gtk/menus.ui</file>
- <file>data/basic.gstyle.xml</file>
+ <file preprocess="xml-stripblanks">data/basic.gstyle.xml</file>
<file>data/svg.gpl</file>
<file compressed="true"
alias="icons/scalable/actions/builder-colorpicker-load-palette.svg">icons/palette/load-palette.svg</file>
diff --git a/src/plugins/color-picker/color-picker.plugin b/src/plugins/color-picker/color-picker.plugin
index 11fc62486..ba3500512 100644
--- a/src/plugins/color-picker/color-picker.plugin
+++ b/src/plugins/color-picker/color-picker.plugin
@@ -1,9 +1,9 @@
[Plugin]
-Module=color-picker-plugin
-Name=Color Picker
-Description=Show a color picker to inspect or change text color codes
Authors=Sébastien Lafargue <slafargue gnome org>
+Builtin=true
Copyright=Copyright © 2016 Sébastien Lafargue
Depends=editor
-Builtin=true
-Embedded=gb_color_picker_register_types
+Description=Show a color picker to inspect or change text color codes
+Embedded=_gb_color_picker_register_types
+Module=color-picker
+Name=Color Picker
diff --git a/src/plugins/color-picker/gb-color-picker-document-monitor.c
b/src/plugins/color-picker/gb-color-picker-document-monitor.c
index c1d5286af..f398a4fe8 100644
--- a/src/plugins/color-picker/gb-color-picker-document-monitor.c
+++ b/src/plugins/color-picker/gb-color-picker-document-monitor.c
@@ -676,7 +676,7 @@ gb_color_picker_document_monitor_queue_oper_cb (gpointer data)
* to the main loop. This can be useful for situations where you do not
* know if you are in a path that must retain a valid GtkTextIter.
*
- * Since: 3.32
+ * Since: 3.26
*/
static void
gb_color_picker_document_monitor_queue_oper (GbColorPickerDocumentMonitor *self,
@@ -724,7 +724,7 @@ gb_color_picker_document_monitor_queue_oper (GbColorPickerDocumentMonitor *self,
* to the main loop. This can be useful for situations where you do not
* know if you are in a path that must retain a valid GtkTextIter.
*
- * Since: 3.32
+ * Since: 3.26
*/
void
gb_color_picker_document_monitor_queue_colorize (GbColorPickerDocumentMonitor *self,
@@ -742,7 +742,7 @@ gb_color_picker_document_monitor_queue_colorize (GbColorPickerDocumentMonitor *s
* to the main loop. This can be useful for situations where you do not
* know if you are in a path that must retain a valid GtkTextIter.
*
- * Since: 3.32
+ * Since: 3.26
*/
void
gb_color_picker_document_monitor_queue_uncolorize (GbColorPickerDocumentMonitor *self,
diff --git a/src/plugins/color-picker/gb-color-picker-document-monitor.h
b/src/plugins/color-picker/gb-color-picker-document-monitor.h
index 0c1070221..06b5d2590 100644
--- a/src/plugins/color-picker/gb-color-picker-document-monitor.h
+++ b/src/plugins/color-picker/gb-color-picker-document-monitor.h
@@ -21,7 +21,7 @@
#pragma once
#include <glib-object.h>
-#include <ide.h>
+#include <libide-editor.h>
#include "gstyle-color.h"
diff --git a/src/plugins/color-picker/gb-color-picker-editor-addin.c
b/src/plugins/color-picker/gb-color-picker-editor-addin.c
index 56b480be3..84b1fc3b2 100644
--- a/src/plugins/color-picker/gb-color-picker-editor-addin.c
+++ b/src/plugins/color-picker/gb-color-picker-editor-addin.c
@@ -24,7 +24,7 @@
#include <gstyle-color-panel.h>
#include "gb-color-picker-editor-addin.h"
-#include "gb-color-picker-editor-view-addin.h"
+#include "gb-color-picker-editor-page-addin.h"
#include "gb-color-picker-prefs.h"
struct _GbColorPickerEditorAddin
@@ -35,7 +35,7 @@ struct _GbColorPickerEditorAddin
* An unowned reference to the editor. This is set/unset when
* load/unload vfuncs are called.
*/
- IdeEditorPerspective *editor;
+ IdeEditorSurface *editor;
/*
* Out preferences to use in conjunction with the pane. This needs
@@ -46,7 +46,7 @@ struct _GbColorPickerEditorAddin
/*
* Our transient panel which we will slide into visibility when
- * the current view is an IdeEditorView with the color-picker
+ * the current view is an IdeEditorPage with the color-picker
* enabled.
*/
GstyleColorPanel *panel;
@@ -58,10 +58,10 @@ struct _GbColorPickerEditorAddin
DzlDockWidget *dock;
/*
- * If the current view in the perspective is an editor view, then
+ * If the current view in the surface is an editor view, then
* this unowned reference will point to that view.
*/
- IdeEditorView *view;
+ IdeEditorPage *view;
/*
* This signal group manages correctly binding/unbinding signals from
@@ -112,8 +112,8 @@ gb_color_picker_editor_addin_add_palette (GbColorPickerEditorAddin *self,
}
static const gchar * internal_palettes[] = {
- "resource:///org/gnome/builder/plugins/color-picker-plugin/data/basic.gstyle.xml",
- "resource:///org/gnome/builder/plugins/color-picker-plugin/data/svg.gpl",
+ "resource:///plugins/color-picker/data/basic.gstyle.xml",
+ "resource:///plugins/color-picker/data/svg.gpl",
};
static void
@@ -155,12 +155,12 @@ gb_color_picker_editor_addin_notify_rgba (GbColorPickerEditorAddin *self,
if (self->view_addin_signals != NULL)
{
- GbColorPickerEditorViewAddin *view_addin;
+ GbColorPickerEditorPageAddin *view_addin;
view_addin = dzl_signal_group_get_target (self->view_addin_signals);
- if (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (view_addin))
- gb_color_picker_editor_view_addin_set_color (view_addin, color);
+ if (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (view_addin))
+ gb_color_picker_editor_page_addin_set_color (view_addin, color);
}
}
@@ -197,16 +197,16 @@ gb_color_picker_editor_addin_show_panel (GbColorPickerEditorAddin *self)
if (self->view != NULL)
{
- IdeLayoutTransientSidebar *sidebar;
- IdeLayoutView *view = IDE_LAYOUT_VIEW (self->view);
+ IdeTransientSidebar *sidebar;
+ IdePage *view = IDE_PAGE (self->view);
if (self->panel == NULL)
gb_color_picker_editor_addin_set_panel (self);
- sidebar = ide_editor_perspective_get_transient_sidebar (self->editor);
+ sidebar = ide_editor_surface_get_transient_sidebar (self->editor);
- ide_layout_transient_sidebar_set_view (sidebar, view);
- ide_layout_transient_sidebar_set_panel (sidebar, GTK_WIDGET (self->dock));
+ ide_transient_sidebar_set_page (sidebar, view);
+ ide_transient_sidebar_set_panel (sidebar, GTK_WIDGET (self->dock));
g_object_set (self->editor, "right-visible", TRUE, NULL);
}
@@ -227,17 +227,17 @@ gb_color_picker_editor_addin_hide_panel (GbColorPickerEditorAddin *self)
static void
gb_color_picker_editor_addin_notify_enabled (GbColorPickerEditorAddin *self,
GParamSpec *pspec,
- GbColorPickerEditorViewAddin *view_addin)
+ GbColorPickerEditorPageAddin *view_addin)
{
g_assert (GB_IS_COLOR_PICKER_EDITOR_ADDIN (self));
- g_assert (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (view_addin));
+ g_assert (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (view_addin));
/* This function is called when the enabled state is toggled
* for the specific view in question. We hide the panel if it
* is current visible, otherwise we show it.
*/
- if (gb_color_picker_editor_view_addin_get_enabled (view_addin))
+ if (gb_color_picker_editor_page_addin_get_enabled (view_addin))
gb_color_picker_editor_addin_show_panel (self);
else
gb_color_picker_editor_addin_hide_panel (self);
@@ -246,13 +246,13 @@ gb_color_picker_editor_addin_notify_enabled (GbColorPickerEditorAddin *self,
static void
gb_color_picker_editor_addin_color_found (GbColorPickerEditorAddin *self,
GstyleColor *color,
- GbColorPickerEditorViewAddin *view_addin)
+ GbColorPickerEditorPageAddin *view_addin)
{
GdkRGBA rgba;
g_assert (GB_IS_COLOR_PICKER_EDITOR_ADDIN (self));
g_assert (GSTYLE_IS_COLOR (color));
- g_assert (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (view_addin));
+ g_assert (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (view_addin));
dzl_signal_group_block (self->view_addin_signals);
gstyle_color_fill_rgba (color, &rgba);
@@ -266,16 +266,16 @@ gb_color_picker_editor_addin_color_found (GbColorPickerEditorAddin *self,
static void
gb_color_picker_editor_addin_load (IdeEditorAddin *addin,
- IdeEditorPerspective *perspective)
+ IdeEditorSurface *surface)
{
GbColorPickerEditorAddin *self = (GbColorPickerEditorAddin *)addin;
- IdeLayoutTransientSidebar *sidebar;
+ IdeTransientSidebar *sidebar;
g_assert (GB_IS_COLOR_PICKER_EDITOR_ADDIN (self));
- g_assert (IDE_IS_EDITOR_PERSPECTIVE (perspective));
+ g_assert (IDE_IS_EDITOR_SURFACE (surface));
- self->editor = perspective;
- self->view_addin_signals = dzl_signal_group_new (GB_TYPE_COLOR_PICKER_EDITOR_VIEW_ADDIN);
+ self->editor = surface;
+ self->view_addin_signals = dzl_signal_group_new (GB_TYPE_COLOR_PICKER_EDITOR_PAGE_ADDIN);
dzl_signal_group_connect_swapped (self->view_addin_signals,
"color-found",
G_CALLBACK (gb_color_picker_editor_addin_color_found),
@@ -297,19 +297,19 @@ gb_color_picker_editor_addin_load (IdeEditorAddin *addin,
G_CALLBACK (gtk_widget_destroyed),
&self->dock);
- sidebar = ide_editor_perspective_get_transient_sidebar (self->editor);
+ sidebar = ide_editor_surface_get_transient_sidebar (self->editor);
gtk_container_add (GTK_CONTAINER (sidebar), GTK_WIDGET (self->dock));
}
static void
gb_color_picker_editor_addin_unload (IdeEditorAddin *addin,
- IdeEditorPerspective *perspective)
+ IdeEditorSurface *surface)
{
GbColorPickerEditorAddin *self = (GbColorPickerEditorAddin *)addin;
g_assert (GB_IS_COLOR_PICKER_EDITOR_ADDIN (self));
- g_assert (IDE_IS_EDITOR_PERSPECTIVE (perspective));
+ g_assert (IDE_IS_EDITOR_SURFACE (surface));
g_clear_object (&self->view_addin_signals);
@@ -325,30 +325,30 @@ gb_color_picker_editor_addin_unload (IdeEditorAddin *addin,
}
static void
-gb_color_picker_editor_addin_view_set (IdeEditorAddin *addin,
- IdeLayoutView *view)
+gb_color_picker_editor_addin_page_set (IdeEditorAddin *addin,
+ IdePage *view)
{
GbColorPickerEditorAddin *self = (GbColorPickerEditorAddin *)addin;
g_assert (GB_IS_COLOR_PICKER_EDITOR_ADDIN (self));
- g_assert (!view || IDE_IS_LAYOUT_VIEW (view));
+ g_assert (!view || IDE_IS_PAGE (view));
- if (IDE_IS_EDITOR_VIEW (view))
+ if (IDE_IS_EDITOR_PAGE (view))
{
- IdeEditorViewAddin *view_addin;
+ IdeEditorPageAddin *view_addin;
- self->view = IDE_EDITOR_VIEW (view);
+ self->view = IDE_EDITOR_PAGE (view);
/* The addin may not be available yet if things are just initializing.
* We'll have to wait for a follow up view-set to make progress.
*/
- view_addin = ide_editor_view_addin_find_by_module_name (self->view, "color-picker-plugin");
- g_assert (!view_addin || GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (view_addin));
+ view_addin = ide_editor_page_addin_find_by_module_name (self->view, "color-picker");
+ g_assert (!view_addin || GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (view_addin));
dzl_signal_group_set_target (self->view_addin_signals, view_addin);
if (view_addin != NULL &&
- gb_color_picker_editor_view_addin_get_enabled (GB_COLOR_PICKER_EDITOR_VIEW_ADDIN (view_addin)))
+ gb_color_picker_editor_page_addin_get_enabled (GB_COLOR_PICKER_EDITOR_PAGE_ADDIN (view_addin)))
gb_color_picker_editor_addin_show_panel (self);
}
else
@@ -364,7 +364,7 @@ editor_addin_iface_init (IdeEditorAddinInterface *iface)
{
iface->load = gb_color_picker_editor_addin_load;
iface->unload = gb_color_picker_editor_addin_unload;
- iface->view_set = gb_color_picker_editor_addin_view_set;
+ iface->page_set = gb_color_picker_editor_addin_page_set;
}
G_DEFINE_TYPE_WITH_CODE (GbColorPickerEditorAddin,
@@ -393,7 +393,7 @@ gb_color_picker_editor_addin_init (GbColorPickerEditorAddin *self)
*
* Returns: (transfer full): a #GstylePalette or %NULL.
*
- * Since: 3.32
+ * Since: 3.26
*/
GstylePalette *
gb_color_picker_editor_addin_create_palette (GbColorPickerEditorAddin *self)
@@ -402,7 +402,7 @@ gb_color_picker_editor_addin_create_palette (GbColorPickerEditorAddin *self)
if (self->view != NULL)
{
- IdeBuffer *buffer = ide_editor_view_get_buffer (self->view);
+ IdeBuffer *buffer = ide_editor_page_get_buffer (self->view);
return gstyle_palette_new_from_buffer (GTK_TEXT_BUFFER (buffer),
NULL, NULL, NULL, NULL);
diff --git a/src/plugins/color-picker/gb-color-picker-editor-addin.h
b/src/plugins/color-picker/gb-color-picker-editor-addin.h
index 1635808ed..4d4a96643 100644
--- a/src/plugins/color-picker/gb-color-picker-editor-addin.h
+++ b/src/plugins/color-picker/gb-color-picker-editor-addin.h
@@ -20,7 +20,7 @@
#pragma once
-#include <ide.h>
+#include <libide-editor.h>
#include <gstyle-palette.h>
diff --git a/src/plugins/color-picker/gb-color-picker-editor-view-addin.c
b/src/plugins/color-picker/gb-color-picker-editor-page-addin.c
similarity index 67%
rename from src/plugins/color-picker/gb-color-picker-editor-view-addin.c
rename to src/plugins/color-picker/gb-color-picker-editor-page-addin.c
index c1aab9cee..cdeb9e1ab 100644
--- a/src/plugins/color-picker/gb-color-picker-editor-view-addin.c
+++ b/src/plugins/color-picker/gb-color-picker-editor-page-addin.c
@@ -1,4 +1,4 @@
-/* gb-color-picker-editor-view-addin.c
+/* gb-color-picker-editor-page-addin.c
*
* Copyright 2017-2019 Christian Hergert <chergert redhat com>
*
@@ -18,17 +18,17 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#define G_LOG_DOMAIN "gb-color-picker-editor-view-addin"
+#define G_LOG_DOMAIN "gb-color-picker-editor-page-addin"
#include "gb-color-picker-document-monitor.h"
-#include "gb-color-picker-editor-view-addin.h"
+#include "gb-color-picker-editor-page-addin.h"
-struct _GbColorPickerEditorViewAddin
+struct _GbColorPickerEditorPageAddin
{
GObject parent_instance;
/* Unowned reference to the view */
- IdeEditorView *view;
+ IdeEditorPage *view;
/* Our document monitor, or NULL */
GbColorPickerDocumentMonitor *monitor;
@@ -55,11 +55,11 @@ static GParamSpec *properties [N_PROPS];
static guint signals [N_SIGNALS];
static void
-monitor_color_found (GbColorPickerEditorViewAddin *self,
+monitor_color_found (GbColorPickerEditorPageAddin *self,
GstyleColor *color,
GbColorPickerDocumentMonitor *monitor)
{
- g_assert (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (self));
+ g_assert (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (self));
g_assert (GSTYLE_IS_COLOR (color));
g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (monitor));
@@ -69,10 +69,10 @@ monitor_color_found (GbColorPickerEditorViewAddin *self,
}
void
-gb_color_picker_editor_view_addin_set_enabled (GbColorPickerEditorViewAddin *self,
+gb_color_picker_editor_page_addin_set_enabled (GbColorPickerEditorPageAddin *self,
gboolean enabled)
{
- g_return_if_fail (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (self));
+ g_return_if_fail (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (self));
enabled = !!enabled;
@@ -88,7 +88,7 @@ gb_color_picker_editor_view_addin_set_enabled (GbColorPickerEditorViewAddin *sel
if (enabled)
{
- IdeBuffer *buffer = ide_editor_view_get_buffer (self->view);
+ IdeBuffer *buffer = ide_editor_page_get_buffer (self->view);
self->enabled = TRUE;
self->monitor = gb_color_picker_document_monitor_new (buffer);
@@ -105,22 +105,22 @@ gb_color_picker_editor_view_addin_set_enabled (GbColorPickerEditorViewAddin *sel
}
gboolean
-gb_color_picker_editor_view_addin_get_enabled (GbColorPickerEditorViewAddin *self)
+gb_color_picker_editor_page_addin_get_enabled (GbColorPickerEditorPageAddin *self)
{
- g_return_val_if_fail (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (self), FALSE);
+ g_return_val_if_fail (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (self), FALSE);
return self->enabled;
}
static void
-gb_color_picker_editor_view_addin_load (IdeEditorViewAddin *addin,
- IdeEditorView *view)
+gb_color_picker_editor_page_addin_load (IdeEditorPageAddin *addin,
+ IdeEditorPage *view)
{
- GbColorPickerEditorViewAddin *self = (GbColorPickerEditorViewAddin *)addin;
+ GbColorPickerEditorPageAddin *self = (GbColorPickerEditorPageAddin *)addin;
g_autoptr(DzlPropertiesGroup) group = NULL;
- g_assert (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (self));
- g_assert (IDE_IS_EDITOR_VIEW (view));
+ g_assert (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (self));
+ g_assert (IDE_IS_EDITOR_PAGE (view));
self->view = view;
@@ -130,13 +130,13 @@ gb_color_picker_editor_view_addin_load (IdeEditorViewAddin *addin,
}
static void
-gb_color_picker_editor_view_addin_unload (IdeEditorViewAddin *addin,
- IdeEditorView *view)
+gb_color_picker_editor_page_addin_unload (IdeEditorPageAddin *addin,
+ IdeEditorPage *view)
{
- GbColorPickerEditorViewAddin *self = (GbColorPickerEditorViewAddin *)addin;
+ GbColorPickerEditorPageAddin *self = (GbColorPickerEditorPageAddin *)addin;
- g_assert (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (self));
- g_assert (IDE_IS_EDITOR_VIEW (view));
+ g_assert (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (self));
+ g_assert (IDE_IS_EDITOR_PAGE (view));
if (self->monitor != NULL)
{
@@ -150,27 +150,27 @@ gb_color_picker_editor_view_addin_unload (IdeEditorViewAddin *addin,
}
static void
-editor_view_addin_iface_init (IdeEditorViewAddinInterface *iface)
+editor_page_addin_iface_init (IdeEditorPageAddinInterface *iface)
{
- iface->load = gb_color_picker_editor_view_addin_load;
- iface->unload = gb_color_picker_editor_view_addin_unload;
+ iface->load = gb_color_picker_editor_page_addin_load;
+ iface->unload = gb_color_picker_editor_page_addin_unload;
}
-G_DEFINE_TYPE_WITH_CODE (GbColorPickerEditorViewAddin, gb_color_picker_editor_view_addin, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_VIEW_ADDIN, editor_view_addin_iface_init))
+G_DEFINE_TYPE_WITH_CODE (GbColorPickerEditorPageAddin, gb_color_picker_editor_page_addin, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_EDITOR_PAGE_ADDIN, editor_page_addin_iface_init))
static void
-gb_color_picker_editor_view_addin_get_property (GObject *object,
+gb_color_picker_editor_page_addin_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- GbColorPickerEditorViewAddin *self = GB_COLOR_PICKER_EDITOR_VIEW_ADDIN (object);
+ GbColorPickerEditorPageAddin *self = GB_COLOR_PICKER_EDITOR_PAGE_ADDIN (object);
switch (prop_id)
{
case PROP_ENABLED:
- g_value_set_boolean (value, gb_color_picker_editor_view_addin_get_enabled (self));
+ g_value_set_boolean (value, gb_color_picker_editor_page_addin_get_enabled (self));
break;
default:
@@ -179,17 +179,17 @@ gb_color_picker_editor_view_addin_get_property (GObject *object,
}
static void
-gb_color_picker_editor_view_addin_set_property (GObject *object,
+gb_color_picker_editor_page_addin_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- GbColorPickerEditorViewAddin *self = GB_COLOR_PICKER_EDITOR_VIEW_ADDIN (object);
+ GbColorPickerEditorPageAddin *self = GB_COLOR_PICKER_EDITOR_PAGE_ADDIN (object);
switch (prop_id)
{
case PROP_ENABLED:
- gb_color_picker_editor_view_addin_set_enabled (self, g_value_get_boolean (value));
+ gb_color_picker_editor_page_addin_set_enabled (self, g_value_get_boolean (value));
break;
default:
@@ -198,12 +198,12 @@ gb_color_picker_editor_view_addin_set_property (GObject *object,
}
static void
-gb_color_picker_editor_view_addin_class_init (GbColorPickerEditorViewAddinClass *klass)
+gb_color_picker_editor_page_addin_class_init (GbColorPickerEditorPageAddinClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->get_property = gb_color_picker_editor_view_addin_get_property;
- object_class->set_property = gb_color_picker_editor_view_addin_set_property;
+ object_class->get_property = gb_color_picker_editor_page_addin_get_property;
+ object_class->set_property = gb_color_picker_editor_page_addin_set_property;
properties [PROP_ENABLED] =
g_param_spec_boolean ("enabled", NULL, NULL,
@@ -221,15 +221,15 @@ gb_color_picker_editor_view_addin_class_init (GbColorPickerEditorViewAddinClass
}
static void
-gb_color_picker_editor_view_addin_init (GbColorPickerEditorViewAddin *self)
+gb_color_picker_editor_page_addin_init (GbColorPickerEditorPageAddin *self)
{
}
void
-gb_color_picker_editor_view_addin_set_color (GbColorPickerEditorViewAddin *self,
+gb_color_picker_editor_page_addin_set_color (GbColorPickerEditorPageAddin *self,
GstyleColor *color)
{
- g_return_if_fail (GB_IS_COLOR_PICKER_EDITOR_VIEW_ADDIN (self));
+ g_return_if_fail (GB_IS_COLOR_PICKER_EDITOR_PAGE_ADDIN (self));
g_return_if_fail (GSTYLE_IS_COLOR (color));
if (self->monitor != NULL && !self->in_color_found)
diff --git a/src/plugins/color-picker/gb-color-picker-editor-view-addin.h
b/src/plugins/color-picker/gb-color-picker-editor-page-addin.h
similarity index 64%
rename from src/plugins/color-picker/gb-color-picker-editor-view-addin.h
rename to src/plugins/color-picker/gb-color-picker-editor-page-addin.h
index 5640d7038..2cbc0494e 100644
--- a/src/plugins/color-picker/gb-color-picker-editor-view-addin.h
+++ b/src/plugins/color-picker/gb-color-picker-editor-page-addin.h
@@ -1,4 +1,4 @@
-/* gb-color-picker-editor-view-addin.h
+/* gb-color-picker-editor-page-addin.h
*
* Copyright 2017-2019 Christian Hergert <chergert redhat com>
*
@@ -20,18 +20,18 @@
#pragma once
-#include <ide.h>
+#include <libide-editor.h>
G_BEGIN_DECLS
-#define GB_TYPE_COLOR_PICKER_EDITOR_VIEW_ADDIN (gb_color_picker_editor_view_addin_get_type())
+#define GB_TYPE_COLOR_PICKER_EDITOR_PAGE_ADDIN (gb_color_picker_editor_page_addin_get_type())
-G_DECLARE_FINAL_TYPE (GbColorPickerEditorViewAddin, gb_color_picker_editor_view_addin, GB,
COLOR_PICKER_EDITOR_VIEW_ADDIN, GObject)
+G_DECLARE_FINAL_TYPE (GbColorPickerEditorPageAddin, gb_color_picker_editor_page_addin, GB,
COLOR_PICKER_EDITOR_PAGE_ADDIN, GObject)
-gboolean gb_color_picker_editor_view_addin_get_enabled (GbColorPickerEditorViewAddin *self);
-void gb_color_picker_editor_view_addin_set_enabled (GbColorPickerEditorViewAddin *self,
+gboolean gb_color_picker_editor_page_addin_get_enabled (GbColorPickerEditorPageAddin *self);
+void gb_color_picker_editor_page_addin_set_enabled (GbColorPickerEditorPageAddin *self,
gboolean enabled);
-void gb_color_picker_editor_view_addin_set_color (GbColorPickerEditorViewAddin *self,
+void gb_color_picker_editor_page_addin_set_color (GbColorPickerEditorPageAddin *self,
GstyleColor *color);
G_END_DECLS
diff --git a/src/plugins/color-picker/gb-color-picker-helper.c
b/src/plugins/color-picker/gb-color-picker-helper.c
index b109c9218..9821fa0e5 100644
--- a/src/plugins/color-picker/gb-color-picker-helper.c
+++ b/src/plugins/color-picker/gb-color-picker-helper.c
@@ -22,7 +22,7 @@
#include <libpeas/peas.h>
#include "gb-color-picker-private.h"
-#include <ide.h>
+#include <libide-editor.h>
#include "gb-color-picker-helper.h"
diff --git a/src/plugins/color-picker/gb-color-picker-plugin.c
b/src/plugins/color-picker/gb-color-picker-plugin.c
index 83226eed7..dc025a27d 100644
--- a/src/plugins/color-picker/gb-color-picker-plugin.c
+++ b/src/plugins/color-picker/gb-color-picker-plugin.c
@@ -18,19 +18,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-#include <ide.h>
+#include "config.h"
+
+#include <libide-editor.h>
#include <libpeas/peas.h>
#include "gb-color-picker-editor-addin.h"
-#include "gb-color-picker-editor-view-addin.h"
+#include "gb-color-picker-editor-page-addin.h"
-void
-gb_color_picker_register_types (PeasObjectModule *module)
+_IDE_EXTERN void
+_gb_color_picker_register_types (PeasObjectModule *module)
{
peas_object_module_register_extension_type (module,
IDE_TYPE_EDITOR_ADDIN,
GB_TYPE_COLOR_PICKER_EDITOR_ADDIN);
peas_object_module_register_extension_type (module,
- IDE_TYPE_EDITOR_VIEW_ADDIN,
- GB_TYPE_COLOR_PICKER_EDITOR_VIEW_ADDIN);
+ IDE_TYPE_EDITOR_PAGE_ADDIN,
+ GB_TYPE_COLOR_PICKER_EDITOR_PAGE_ADDIN);
}
diff --git a/src/plugins/color-picker/gb-color-picker-prefs-palette-row.c
b/src/plugins/color-picker/gb-color-picker-prefs-palette-row.c
index 1f3c16109..d1326f042 100644
--- a/src/plugins/color-picker/gb-color-picker-prefs-palette-row.c
+++ b/src/plugins/color-picker/gb-color-picker-prefs-palette-row.c
@@ -20,7 +20,7 @@
#include <gdk/gdk.h>
#include "glib/gi18n.h"
-#include <ide.h>
+#include <libide-editor.h>
#include "gstyle-rename-popover.h"
@@ -506,7 +506,7 @@ gb_color_picker_prefs_palette_row_class_init (GbColorPickerPrefsPaletteRowClass
g_object_class_install_properties (object_class, N_PROPS, properties);
- gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/builder/plugins/color-picker-plugin/gtk/color-picker-palette-row.ui");
+ gtk_widget_class_set_template_from_resource (widget_class,
"/plugins/color-picker/gtk/color-picker-palette-row.ui");
gtk_widget_class_bind_template_child (widget_class, GbColorPickerPrefsPaletteRow, image);
gtk_widget_class_bind_template_child (widget_class, GbColorPickerPrefsPaletteRow, event_box);
gtk_widget_class_bind_template_child (widget_class, GbColorPickerPrefsPaletteRow, palette_name);
@@ -528,7 +528,7 @@ gb_color_picker_prefs_palette_row_init (GbColorPickerPrefsPaletteRow *self)
G_CALLBACK (event_box_button_pressed_cb),
self);
- builder = gtk_builder_new_from_resource
("/org/gnome/builder/plugins/color-picker-plugin/gtk/color-picker-palette-menu.ui");
+ builder = gtk_builder_new_from_resource ("/plugins/color-picker/gtk/color-picker-palette-menu.ui");
self->popover_menu = GTK_WIDGET (g_object_ref_sink (gtk_builder_get_object (builder, "popover")));
button_rename = GTK_WIDGET (gtk_builder_get_object (builder, "button_rename"));
g_signal_connect_object (button_rename, "button-release-event",
diff --git a/src/plugins/color-picker/gb-color-picker-prefs.c
b/src/plugins/color-picker/gb-color-picker-prefs.c
index 69f7aed4d..3e4d8e0bb 100644
--- a/src/plugins/color-picker/gb-color-picker-prefs.c
+++ b/src/plugins/color-picker/gb-color-picker-prefs.c
@@ -20,7 +20,7 @@
#include <glib/gi18n.h>
-#include <ide.h>
+#include <libide-editor.h>
#include "gb-color-picker-editor-addin.h"
#include "gb-color-picker-prefs.h"
@@ -369,8 +369,8 @@ generate_palette_button_clicked_cb (GbColorPickerPrefs *self,
g_assert (GB_IS_COLOR_PICKER_PREFS (self));
g_assert (GTK_IS_BUTTON (button));
- editor = gtk_widget_get_ancestor (GTK_WIDGET (self), IDE_TYPE_EDITOR_PERSPECTIVE);
- addin = ide_editor_addin_find_by_module_name (IDE_EDITOR_PERSPECTIVE (editor), "color-picker-plugin");
+ editor = gtk_widget_get_ancestor (GTK_WIDGET (self), IDE_TYPE_EDITOR_SURFACE);
+ addin = ide_editor_addin_find_by_module_name (IDE_EDITOR_SURFACE (editor), "color-picker");
palette = gb_color_picker_editor_addin_create_palette (GB_COLOR_PICKER_EDITOR_ADDIN (addin));
if (palette != NULL)
@@ -682,7 +682,7 @@ gb_color_picker_prefs_init (GbColorPickerPrefs *self)
g_type_ensure (GB_TYPE_COLOR_PICKER_PREFS_LIST);
g_type_ensure (GB_TYPE_COLOR_PICKER_PREFS_PALETTE_LIST);
- builder = gtk_builder_new_from_resource
("/org/gnome/builder/plugins/color-picker-plugin/gtk/color-picker-prefs.ui");
+ builder = gtk_builder_new_from_resource ("/plugins/color-picker/gtk/color-picker-prefs.ui");
self->palettes_box = GB_COLOR_PICKER_PREFS_PALETTE_LIST (gtk_builder_get_object (builder, "palettes_box"));
palettes_placeholder = GTK_WIDGET (gtk_builder_get_object (builder, "palettes_placeholder"));
@@ -730,7 +730,7 @@ gb_color_picker_prefs_init (GbColorPickerPrefs *self)
g_object_unref (builder);
- builder = gtk_builder_new_from_resource
("/org/gnome/builder/plugins/color-picker-plugin/gtk/color-picker-preview.ui");
+ builder = gtk_builder_new_from_resource ("/plugins/color-picker/gtk/color-picker-preview.ui");
self->preview = GTK_WIDGET (gtk_builder_get_object (builder, "preview"));
g_object_ref_sink (self->preview);
self->preview_palette_widget = GTK_WIDGET (gtk_builder_get_object (builder, "preview_palette_widget"));
diff --git a/src/plugins/color-picker/meson.build b/src/plugins/color-picker/meson.build
index 198b4b521..cbfca15eb 100644
--- a/src/plugins/color-picker/meson.build
+++ b/src/plugins/color-picker/meson.build
@@ -1,38 +1,27 @@
-if get_option('with_color_picker')
+if get_option('plugin_code_index')
-color_picker_resources = gnome.compile_resources(
- 'gb-color-picker-resources',
- 'gb-color-picker.gresource.xml',
- c_name: 'gb_color_picker',
-)
+install_data('gsettings/org.gnome.builder.plugins.color_picker_plugin.gschema.xml', install_dir: schema_dir)
+
+plugins_deps += libgstyle_dep
-color_picker_sources = [
+plugins_sources += files([
+ 'gb-color-picker-document-monitor.c',
'gb-color-picker-editor-addin.c',
- 'gb-color-picker-editor-addin.h',
- 'gb-color-picker-editor-view-addin.c',
- 'gb-color-picker-editor-view-addin.h',
+ 'gb-color-picker-editor-page-addin.c',
'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',
-]
-
-gnome_builder_plugins_deps += [libgstyle_dep]
-gnome_builder_plugins_sources += files(color_picker_sources)
-gnome_builder_plugins_sources += color_picker_resources[0]
+ 'gb-color-picker-prefs.c',
+])
-install_data('gsettings/org.gnome.builder.plugins.color_picker_plugin.gschema.xml',
- install_dir: schema_dir,
+plugin_color_picker_resources = gnome.compile_resources(
+ 'gbp-color-picker-resources',
+ 'color-picker.gresource.xml',
+ c_name: 'gbp_color_picker',
)
+plugins_sources += plugin_color_picker_resources[0]
+
endif
diff --git a/src/plugins/color-picker/themes/Adwaita-dark.css
b/src/plugins/color-picker/themes/Adwaita-dark.css
index efd6d6ee9..d59762ff7 100644
--- a/src/plugins/color-picker/themes/Adwaita-dark.css
+++ b/src/plugins/color-picker/themes/Adwaita-dark.css
@@ -1,4 +1,4 @@
-@import url("resource:///org/gnome/builder/plugins/color-picker-plugin/themes/shared.css");
+@import url("resource:///plugins/color-picker/themes/shared.css");
/* palettew widget dnd indicator */
gstylecolorpanel gstylepalettewidget.dnd {
diff --git a/src/plugins/color-picker/themes/Adwaita.css b/src/plugins/color-picker/themes/Adwaita.css
index aa154d0bd..bdcb10615 100644
--- a/src/plugins/color-picker/themes/Adwaita.css
+++ b/src/plugins/color-picker/themes/Adwaita.css
@@ -1,4 +1,4 @@
-@import url("resource:///org/gnome/builder/plugins/color-picker-plugin/themes/shared.css");
+@import url("resource:///plugins/color-picker/themes/shared.css");
/*
* FileChooserDialog preview
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]