[libpanel] libpanel: drop foreground/background rgba abstractions
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpanel] libpanel: drop foreground/background rgba abstractions
- Date: Wed, 27 Jul 2022 19:59:53 +0000 (UTC)
commit 479cabd7624049a2755802821b3249ec7ab21915
Author: Christian Hergert <chergert redhat com>
Date: Wed Jul 27 12:59:46 2022 -0700
libpanel: drop foreground/background rgba abstractions
We should be doing this with libadwaita recoloring, so just delete all
that code so we don't have to maintain it, before it's too late.
example/example-page.c | 50 -----------
example/example-window.ui | 16 ----
src/panel-frame-header-bar.c | 197 -----------------------------------------
src/panel-frame-header-bar.h | 10 ---
src/panel-frame-switcher.c | 204 -------------------------------------------
src/panel-frame-switcher.h | 12 +--
src/panel-widget.c | 148 -------------------------------
src/panel-widget.h | 10 ---
8 files changed, 1 insertion(+), 646 deletions(-)
---
diff --git a/example/example-page.c b/example/example-page.c
index bd523f8..c32aac0 100644
--- a/example/example-page.c
+++ b/example/example-page.c
@@ -132,50 +132,6 @@ example_page_class_init (ExamplePageClass *klass)
g_object_class_install_properties (object_class, N_PROPS, properties);
}
-#ifdef HAVE_GTKSOURCEVIEW
-static void
-notify_style_scheme_cb (ExamplePage *self,
- GParamSpec *pspec,
- GtkSourceBuffer *buffer)
-{
- GtkSourceStyleScheme *scheme = gtk_source_buffer_get_style_scheme (buffer);
- GtkSourceStyle *text;
-
- if (scheme)
- {
- text = gtk_source_style_scheme_get_style (scheme, "text");
-
- if (text != NULL)
- {
- g_autofree char *fg = NULL;
- g_autofree char *bg = NULL;
- gboolean fg_set = FALSE;
- gboolean bg_set = FALSE;
- GdkRGBA rgba;
-
- g_object_get (text,
- "foreground", &fg,
- "foreground-set", &fg_set,
- "background", &bg,
- "background-set", &bg_set,
- NULL);
-
- if (bg_set && bg)
- {
- gdk_rgba_parse (&rgba, bg);
- panel_widget_set_background_rgba (PANEL_WIDGET (self), &rgba);
- }
-
- if (fg_set && fg)
- {
- gdk_rgba_parse (&rgba, fg);
- panel_widget_set_foreground_rgba (PANEL_WIDGET (self), &rgba);
- }
- }
- }
-}
-#endif
-
static void
example_page_init (ExamplePage *self)
{
@@ -196,12 +152,6 @@ example_page_init (ExamplePage *self)
self->text_view = GTK_TEXT_VIEW (gtk_source_view_new ());
buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (self->text_view));
- g_signal_connect_object (buffer,
- "notify::style-scheme",
- G_CALLBACK (notify_style_scheme_cb),
- self,
- G_CONNECT_SWAPPED);
-
gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (self->text_view), TRUE);
gtk_source_buffer_set_language (buffer, lang);
diff --git a/example/example-window.ui b/example/example-window.ui
index bc2e0f7..0906541 100644
--- a/example/example-window.ui
+++ b/example/example-window.ui
@@ -371,9 +371,6 @@
<object class="PanelFrame">
<child>
<object class="PanelWidget">
- <!-- you might want to set background-rgba by retrieving
- your document colors, such as from GtkSourceStyleScheme -->
- <property name="background-rgba">#fff</property>
<property name="title">Color</property>
<property name="can-maximize">true</property>
<property name="icon-name">color-select-symbolic</property>
@@ -385,7 +382,6 @@
</child>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#fff</property>
<property name="title">Swatches</property>
<property name="icon-name">preferences-color-symbolic</property>
<property name="can-maximize">true</property>
@@ -404,7 +400,6 @@
<object class="PanelFrame">
<child>
<object class="PanelWidget">
- <property name="background-rgba">#fff</property>
<property name="title">Adjustments</property>
<child>
<object class="GtkScrolledWindow">
@@ -418,7 +413,6 @@
<child>
<object class="PanelWidget">
<property name="title">Styles</property>
- <property name="background-rgba">#fff</property>
<child>
<object class="GtkScrolledWindow">
<child>
@@ -435,7 +429,6 @@
<child>
<object class="PanelWidget">
<property name="title">Layers</property>
- <property name="background-rgba">#fff</property>
<child>
<object class="GtkScrolledWindow">
<child>
@@ -448,7 +441,6 @@
<child>
<object class="PanelWidget">
<property name="title">Channels</property>
- <property name="background-rgba">#fff</property>
<child>
<object class="GtkScrolledWindow">
<child>
@@ -460,7 +452,6 @@
</child>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#fff</property>
<property name="title">Paths</property>
<child>
<object class="GtkScrolledWindow">
@@ -483,7 +474,6 @@
<property name="orientation">horizontal</property>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#fff</property>
<property name="icon-name">edit-find-symbolic</property>
<property name="title">Find in Files</property>
<property name="can-maximize">true</property>
@@ -495,7 +485,6 @@
</child>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#fff</property>
<property name="title">Terminal</property>
<property name="icon-name">utilities-terminal-symbolic</property>
<property name="can-maximize">true</property>
@@ -518,7 +507,6 @@
</child>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#000</property>
<property name="title">Build Output</property>
<property name="icon-name">builder-build-symbolic</property>
<property name="can-maximize">true</property>
@@ -533,7 +521,6 @@
</child>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#000</property>
<property name="title">Application Output</property>
<property name="icon-name">media-playback-start-symbolic</property>
<property name="can-maximize">true</property>
@@ -558,7 +545,6 @@
<property name="orientation">vertical</property>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#fff</property>
<property name="icon-name">view-list-symbolic</property>
<property name="title">Project Tree</property>
<property name="can-maximize">true</property>
@@ -709,7 +695,6 @@
</child>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#fff</property>
<property name="title">Build Issues</property>
<property name="icon-name">builder-build-symbolic</property>
<property name="can-maximize">true</property>
@@ -724,7 +709,6 @@
</child>
<child>
<object class="PanelWidget">
- <property name="background-rgba">#fff</property>
<property name="title">TODOs/FIXMEs</property>
<property name="icon-name">object-select-symbolic</property>
<property name="can-maximize">true</property>
diff --git a/src/panel-frame-header-bar.c b/src/panel-frame-header-bar.c
index 10b6df5..381abe5 100644
--- a/src/panel-frame-header-bar.c
+++ b/src/panel-frame-header-bar.c
@@ -40,7 +40,6 @@ struct _PanelFrameHeaderBar
GMenuModel *menu_model;
PanelWidget *visible_child;
PanelJoinedMenu *joined_menu;
- GtkCssProvider *css_provider;
GMenuModel *frame_menu;
GtkBox *box;
@@ -59,13 +58,6 @@ struct _PanelFrameHeaderBar
PanelWidget *drag_panel;
GtkWidget *drag_dock;
- GdkRGBA background_rgba;
- GdkRGBA foreground_rgba;
-
- guint update_css_handler;
-
- guint background_rgba_set : 1;
- guint foreground_rgba_set : 1;
guint show_icon : 1;
};
@@ -76,8 +68,6 @@ G_DEFINE_TYPE_WITH_CODE (PanelFrameHeaderBar, panel_frame_header_bar, GTK_TYPE_W
enum {
PROP_0,
- PROP_BACKGROUND_RGBA,
- PROP_FOREGROUND_RGBA,
PROP_SHOW_ICON,
N_PROPS,
@@ -85,7 +75,6 @@ enum {
};
static GParamSpec *properties [N_PROPS];
-static GQuark css_quark;
/**
* panel_frame_header_bar_new:
@@ -167,59 +156,6 @@ unbind_row_cb (GtkSignalListItemFactory *factory,
panel_frame_header_bar_row_set_page (PANEL_FRAME_HEADER_BAR_ROW (row), NULL);
}
-static gboolean
-panel_frame_header_bar_update_css (PanelFrameHeaderBar *self)
-{
- GString *str = NULL;
-
- g_assert (PANEL_IS_FRAME_HEADER_BAR (self));
- g_assert (self->css_provider != NULL);
- g_assert (GTK_IS_CSS_PROVIDER (self->css_provider));
-
- str = g_string_new (NULL);
-
- if (self->background_rgba_set)
- {
- gchar *bgstr = gdk_rgba_to_string (&self->background_rgba);
-
- g_string_append_printf (str, "panelframeheaderbar { background-color: %s; }", bgstr);
-
- /* only use foreground when background is set */
- if (self->foreground_rgba_set)
- {
- gchar *fgstr = gdk_rgba_to_string (&self->foreground_rgba);
- g_string_append_printf (str, "panelframeheaderbar { color: %s; }", fgstr);
- g_free (fgstr);
- }
-
- g_free (bgstr);
- }
-
- /* Use -1 for length so CSS provider knows the string is NULL terminated
- * and there-by avoid a string copy.
- */
- gtk_css_provider_load_from_data (self->css_provider, str->str, -1);
-
- self->update_css_handler = 0;
-
- g_string_free (str, TRUE);
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-panel_frame_header_bar_queue_update_css (PanelFrameHeaderBar *self)
-{
- g_assert (PANEL_IS_FRAME_HEADER_BAR (self));
-
- if (self->update_css_handler == 0)
- self->update_css_handler =
- g_idle_add_full (G_PRIORITY_HIGH,
- (GSourceFunc)panel_frame_header_bar_update_css,
- g_object_ref (self),
- g_object_unref);
-}
-
static void
panel_frame_header_bar_set_frame (PanelFrameHeaderBar *self,
PanelFrame *frame)
@@ -367,8 +303,6 @@ panel_frame_header_bar_dispose (GObject *object)
{
PanelFrameHeaderBar *self = (PanelFrameHeaderBar *)object;
- g_clear_handle_id (&self->update_css_handler, g_source_remove);
-
panel_frame_header_bar_set_frame (self, NULL);
g_clear_pointer ((GtkWidget **)&self->box, gtk_widget_unparent);
@@ -376,7 +310,6 @@ panel_frame_header_bar_dispose (GObject *object)
g_clear_object (&self->visible_child);
g_clear_object (&self->frame);
g_clear_object (&self->menu_model);
- g_clear_object (&self->css_provider);
g_clear_object (&self->bindings);
g_clear_object (&self->joined_menu);
@@ -393,14 +326,6 @@ panel_frame_header_bar_get_property (GObject *object,
switch (prop_id)
{
- case PROP_BACKGROUND_RGBA:
- g_value_set_boxed (value, panel_frame_header_bar_get_background_rgba (self));
- break;
-
- case PROP_FOREGROUND_RGBA:
- g_value_set_boxed (value, panel_frame_header_bar_get_foreground_rgba (self));
- break;
-
case PROP_FRAME:
g_value_set_object (value, self->frame);
break;
@@ -424,14 +349,6 @@ panel_frame_header_bar_set_property (GObject *object,
switch (prop_id)
{
- case PROP_BACKGROUND_RGBA:
- panel_frame_header_bar_set_background_rgba (self, g_value_get_boxed (value));
- break;
-
- case PROP_FOREGROUND_RGBA:
- panel_frame_header_bar_set_foreground_rgba (self, g_value_get_boxed (value));
- break;
-
case PROP_FRAME:
panel_frame_header_bar_set_frame (self, g_value_get_object (value));
break;
@@ -455,35 +372,6 @@ panel_frame_header_bar_class_init (PanelFrameHeaderBarClass *klass)
object_class->get_property = panel_frame_header_bar_get_property;
object_class->set_property = panel_frame_header_bar_set_property;
- /**
- * PanelFrameHeaderBar:background-rgba:
- *
- * The "background-rgba" property can be used to set the background
- * color of the header. This should be set to the
- * #PanelWidget:background-rgba of the active view.
- *
- * Set to %NULL to unset the background-rgba.
- */
- properties [PROP_BACKGROUND_RGBA] =
- g_param_spec_boxed ("background-rgba",
- "Background RGBA",
- "The background color to use for the header",
- GDK_TYPE_RGBA,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
- /**
- * PanelFrameHeaderBar:foreground-rgba:
- *
- * Sets the foreground color to use when
- * #PanelFrameHeaderBar:background-rgba is used for the background.
- */
- properties [PROP_FOREGROUND_RGBA] =
- g_param_spec_boxed ("foreground-rgba",
- "Foreground RGBA",
- "The foreground color to use with background-rgba",
- GDK_TYPE_RGBA,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
properties [PROP_SHOW_ICON] =
g_param_spec_boolean ("show-icon",
"Show Icon",
@@ -513,8 +401,6 @@ panel_frame_header_bar_class_init (PanelFrameHeaderBarClass *klass)
gtk_widget_class_bind_template_callback (widget_class, drag_begin_cb);
gtk_widget_class_bind_template_callback (widget_class, drag_end_cb);
gtk_widget_class_bind_template_callback (widget_class, drag_prepare_cb);
-
- css_quark = g_quark_from_static_string ("css-provider");
}
static void
@@ -523,11 +409,6 @@ panel_frame_header_bar_init (PanelFrameHeaderBar *self)
GtkWidget *button;
GtkWidget *box;
- self->css_provider = gtk_css_provider_new ();
- gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (self)),
- GTK_STYLE_PROVIDER (self->css_provider),
- GTK_STYLE_PROVIDER_PRIORITY_THEME+1);
-
gtk_widget_init_template (GTK_WIDGET (self));
gtk_widget_set_cursor_from_name (GTK_WIDGET (self->drag_button), "grab");
@@ -565,8 +446,6 @@ panel_frame_header_bar_init (PanelFrameHeaderBar *self)
self->modified, "label",
0, boolean_to_modified, NULL, NULL, NULL);
panel_binding_group_bind (self->bindings, "icon", self->image, "gicon", 0);
- panel_binding_group_bind (self->bindings, "background-rgba", self, "background-rgba", 0);
- panel_binding_group_bind (self->bindings, "foreground-rgba", self, "foreground-rgba", 0);
}
static gboolean
@@ -604,10 +483,6 @@ panel_frame_header_bar_page_changed (PanelFrameHeader *header,
gtk_widget_set_sensitive (GTK_WIDGET (self->menu_button), page != NULL);
gtk_widget_set_sensitive (GTK_WIDGET (self->drag_button), page != NULL);
- self->foreground_rgba_set = FALSE;
- self->background_rgba_set = FALSE;
- panel_frame_header_bar_queue_update_css (self);
-
panel_binding_group_set_source (self->bindings, page);
gtk_widget_set_sensitive (GTK_WIDGET (self->title_button), page != NULL);
@@ -695,78 +570,6 @@ panel_frame_header_bar_get_menu_popover (PanelFrameHeaderBar *self)
return GTK_POPOVER_MENU (gtk_menu_button_get_popover (self->menu_button));
}
-/**
- * panel_frame_header_bar_get_background_rgba:
- * @self: a #PanelFrameHeaderBar
- *
- * Gets the background color of the header bar.
- *
- * Returns: (nullable): the background color
- */
-const GdkRGBA *
-panel_frame_header_bar_get_background_rgba (PanelFrameHeaderBar *self)
-{
- g_return_val_if_fail (PANEL_IS_FRAME_HEADER_BAR (self), NULL);
-
- return self->background_rgba_set ? &self->background_rgba : NULL;
-}
-
-/**
- * panel_frame_header_bar_set_background_rgba:
- * @self: a #PanelFrameHeaderBar
- * @background_rgba: (nullable): the background color
- *
- * Sets the background color of the header bar.
- */
-void
-panel_frame_header_bar_set_background_rgba (PanelFrameHeaderBar *self,
- const GdkRGBA *background_rgba)
-{
- g_return_if_fail (PANEL_IS_FRAME_HEADER_BAR (self));
-
- self->background_rgba_set = background_rgba != NULL;
- if (background_rgba)
- self->background_rgba = *background_rgba;
- panel_frame_header_bar_queue_update_css (self);
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_BACKGROUND_RGBA]);
-}
-
-/**
- * panel_frame_header_bar_get_foreground_rgba:
- * @self: a #PanelFrameHeaderBar
- *
- * Gets the foreground color of the header bar.
- *
- * Returns: (nullable): the foreground color
- */
-const GdkRGBA *
-panel_frame_header_bar_get_foreground_rgba (PanelFrameHeaderBar *self)
-{
- g_return_val_if_fail (PANEL_IS_FRAME_HEADER_BAR (self), NULL);
-
- return self->foreground_rgba_set ? &self->foreground_rgba : NULL;
-}
-
-/**
- * panel_frame_header_bar_set_foreground_rgba:
- * @self: a #PanelFrameHeaderBar
- * @foreground_rgba: (nullable): the foreground color
- *
- * Sets the foreground color of the header bar.
- */
-void
-panel_frame_header_bar_set_foreground_rgba (PanelFrameHeaderBar *self,
- const GdkRGBA *foreground_rgba)
-{
- g_return_if_fail (PANEL_IS_FRAME_HEADER_BAR (self));
-
- self->foreground_rgba_set = foreground_rgba != NULL;
- if (foreground_rgba)
- self->foreground_rgba = *foreground_rgba;
- panel_frame_header_bar_queue_update_css (self);
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_FOREGROUND_RGBA]);
-}
-
gboolean
panel_frame_header_bar_get_show_icon (PanelFrameHeaderBar *self)
{
diff --git a/src/panel-frame-header-bar.h b/src/panel-frame-header-bar.h
index eb6aa48..4786b6c 100644
--- a/src/panel-frame-header-bar.h
+++ b/src/panel-frame-header-bar.h
@@ -36,16 +36,6 @@ GtkWidget *panel_frame_header_bar_new (void);
PANEL_AVAILABLE_IN_ALL
GtkPopoverMenu *panel_frame_header_bar_get_menu_popover (PanelFrameHeaderBar *self);
PANEL_AVAILABLE_IN_ALL
-const GdkRGBA *panel_frame_header_bar_get_foreground_rgba (PanelFrameHeaderBar *self);
-PANEL_AVAILABLE_IN_ALL
-void panel_frame_header_bar_set_foreground_rgba (PanelFrameHeaderBar *self,
- const GdkRGBA *foreground_rgba);
-PANEL_AVAILABLE_IN_ALL
-const GdkRGBA *panel_frame_header_bar_get_background_rgba (PanelFrameHeaderBar *self);
-PANEL_AVAILABLE_IN_ALL
-void panel_frame_header_bar_set_background_rgba (PanelFrameHeaderBar *self,
- const GdkRGBA *background_rgba);
-PANEL_AVAILABLE_IN_ALL
gboolean panel_frame_header_bar_get_show_icon (PanelFrameHeaderBar *self);
PANEL_AVAILABLE_IN_ALL
void panel_frame_header_bar_set_show_icon (PanelFrameHeaderBar *self,
diff --git a/src/panel-frame-switcher.c b/src/panel-frame-switcher.c
index e55cfe3..7a7d619 100644
--- a/src/panel-frame-switcher.c
+++ b/src/panel-frame-switcher.c
@@ -41,8 +41,6 @@ struct _PanelFrameSwitcher
{
GtkWidget parent_instance;
- PanelBindingGroup *bindings;
- GtkCssProvider *css_provider;
PanelFrame *frame;
GtkSelectionModel *pages;
GHashTable *buttons;
@@ -51,14 +49,6 @@ struct _PanelFrameSwitcher
GtkWidget *drop_before_button;
GskRenderNode *drop_indicator;
-
- GdkRGBA foreground_rgba;
- GdkRGBA background_rgba;
-
- guint update_css_handler;
-
- guint foreground_rgba_set : 1;
- guint background_rgba_set : 1;
};
struct _PanelFrameSwitcherClass
@@ -77,16 +67,12 @@ G_DEFINE_TYPE_WITH_CODE (PanelFrameSwitcher, panel_frame_switcher, GTK_TYPE_WIDG
enum {
PROP_0,
- PROP_FOREGROUND_RGBA,
- PROP_BACKGROUND_RGBA,
N_PROPS,
PROP_FRAME,
PROP_ORIENTATION,
};
-static GParamSpec *properties [N_PROPS];
-
static void
ensure_indicator (PanelFrameSwitcher *self)
{
@@ -143,15 +129,6 @@ panel_frame_switcher_init (PanelFrameSwitcher *switcher)
{
switcher->buttons = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
- switcher->bindings = panel_binding_group_new ();
- panel_binding_group_bind (switcher->bindings, "background-rgba", switcher, "background-rgba", 0);
- panel_binding_group_bind (switcher->bindings, "foreground-rgba", switcher, "foreground-rgba", 0);
-
- switcher->css_provider = gtk_css_provider_new ();
- gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (switcher)),
- GTK_STYLE_PROVIDER (switcher->css_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
gtk_widget_add_css_class (GTK_WIDGET (switcher), "linked");
_panel_dock_update_orientation (GTK_WIDGET (switcher), GTK_ORIENTATION_HORIZONTAL);
@@ -802,14 +779,6 @@ panel_frame_switcher_get_property (GObject *object,
g_value_set_object (value, panel_frame_switcher_get_frame (switcher));
break;
- case PROP_BACKGROUND_RGBA:
- g_value_set_boxed (value, panel_frame_switcher_get_background_rgba (switcher));
- break;
-
- case PROP_FOREGROUND_RGBA:
- g_value_set_boxed (value, panel_frame_switcher_get_foreground_rgba (switcher));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -844,14 +813,6 @@ panel_frame_switcher_set_property (GObject *object,
panel_frame_switcher_set_frame (switcher, g_value_get_object (value));
break;
- case PROP_BACKGROUND_RGBA:
- panel_frame_switcher_set_background_rgba (switcher, g_value_get_boxed (value));
- break;
-
- case PROP_FOREGROUND_RGBA:
- panel_frame_switcher_set_foreground_rgba (switcher, g_value_get_boxed (value));
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -876,9 +837,6 @@ panel_frame_switcher_dispose (GObject *object)
{
PanelFrameSwitcher *switcher = PANEL_FRAME_SWITCHER (object);
- g_clear_handle_id (&switcher->update_css_handler, g_source_remove);
- g_clear_object (&switcher->css_provider);
- g_clear_object (&switcher->bindings);
unset_frame (switcher);
g_clear_pointer (&switcher->drop_indicator, gsk_render_node_unref);
@@ -910,22 +868,6 @@ panel_frame_switcher_class_init (PanelFrameSwitcherClass *class)
widget_class->snapshot = panel_frame_switcher_snapshot;
widget_class->css_changed = panel_frame_switcher_css_changed;
- properties [PROP_BACKGROUND_RGBA] =
- g_param_spec_boxed ("background-rgba",
- "Background RGBA",
- "Background RGBA",
- GDK_TYPE_RGBA,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
- properties [PROP_FOREGROUND_RGBA] =
- g_param_spec_boxed ("foreground-rgba",
- "Foreground RGBA",
- "Foreground RGBA",
- GDK_TYPE_RGBA,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
- g_object_class_install_properties (object_class, N_PROPS, properties);
-
g_object_class_override_property (object_class, PROP_FRAME, "frame");
g_object_class_override_property (object_class, PROP_ORIENTATION, "orientation");
@@ -963,156 +905,10 @@ panel_frame_switcher_can_drop (PanelFrameHeader *header,
return g_strcmp0 (kind, PANEL_WIDGET_KIND_DOCUMENT) != 0;
}
-static gboolean
-panel_frame_switcher_update_css (PanelFrameSwitcher *self)
-{
- GString *str = NULL;
-
- g_assert (PANEL_IS_FRAME_SWITCHER (self));
- g_assert (self->css_provider != NULL);
- g_assert (GTK_IS_CSS_PROVIDER (self->css_provider));
-
- str = g_string_new (NULL);
-
- /*
- * We set various styles on this provider so that we can update multiple
- * widgets using the same CSS style. That includes ourself, various buttons,
- * labels, and some images.
- */
-
- if (self->background_rgba_set)
- {
-#if 0
- /* FIXME: Make work with updated css style */
- gchar *bgstr = gdk_rgba_to_string (&self->background_rgba);
-
- g_string_append (str, "panelframeswitcher {\n");
- g_string_append (str, " background: none;\n");
- g_string_append_printf (str, " background-color: %s;\n", bgstr);
- g_string_append (str, "}\n");
-
- g_free (bgstr);
-#endif
- }
-
- /* Use -1 for length so CSS provider knows the string is NULL terminated
- * and there-by avoid a string copy.
- */
- gtk_css_provider_load_from_data (self->css_provider, str->str, -1);
-
- self->update_css_handler = 0;
-
- g_string_free (str, TRUE);
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-panel_frame_switcher_queue_update_css (PanelFrameSwitcher *self)
-{
- g_assert (PANEL_IS_FRAME_SWITCHER (self));
-
- if (self->update_css_handler == 0)
- self->update_css_handler =
- g_idle_add_full (G_PRIORITY_HIGH,
- (GSourceFunc)panel_frame_switcher_update_css,
- g_object_ref (self),
- g_object_unref);
-}
-
-static void
-panel_frame_switcher_page_changed (PanelFrameHeader *header,
- PanelWidget *widget)
-{
- PanelFrameSwitcher *self = (PanelFrameSwitcher *)header;
-
- g_assert (PANEL_IS_FRAME_HEADER (header));
- g_assert (!widget || PANEL_IS_WIDGET (widget));
-
- self->foreground_rgba_set = FALSE;
- self->background_rgba_set = FALSE;
- panel_frame_switcher_queue_update_css (self);
-
- panel_binding_group_set_source (self->bindings, widget);
-}
-
static void
frame_header_iface_init (PanelFrameHeaderInterface *iface)
{
iface->can_drop = panel_frame_switcher_can_drop;
- iface->page_changed = panel_frame_switcher_page_changed;
-}
-
-/**
- * panel_frame_switcher_get_background_rgba:
- * @self: a #PanelFrameSwitcher
- *
- * Gets the background color of the switcher.
- *
- * Returns: (nullable): the background color
- */
-const GdkRGBA *
-panel_frame_switcher_get_background_rgba (PanelFrameSwitcher *self)
-{
- g_return_val_if_fail (PANEL_IS_FRAME_SWITCHER (self), NULL);
-
- return self->background_rgba_set ? &self->background_rgba : NULL;
-}
-
-/**
- * panel_frame_switcher_set_background_rgba:
- * @self: a #PanelFrameSwitcher
- * @background_rgba: (nullable): the background color
- *
- * Sets the background color of the switcher.
- */
-void
-panel_frame_switcher_set_background_rgba (PanelFrameSwitcher *self,
- const GdkRGBA *background_rgba)
-{
- g_return_if_fail (PANEL_IS_FRAME_SWITCHER (self));
-
- self->background_rgba_set = background_rgba != NULL;
- if (background_rgba)
- self->background_rgba = *background_rgba;
- panel_frame_switcher_queue_update_css (self);
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_BACKGROUND_RGBA]);
-}
-
-/**
- * panel_frame_switcher_get_foreground_rgba:
- * @self: a #PanelFrameSwitcher
- *
- * Gets the foreground color of the switcher.
- *
- * Returns: (nullable): the foreground color
- */
-const GdkRGBA *
-panel_frame_switcher_get_foreground_rgba (PanelFrameSwitcher *self)
-{
- g_return_val_if_fail (PANEL_IS_FRAME_SWITCHER (self), NULL);
-
- return self->foreground_rgba_set ? &self->foreground_rgba : NULL;
-}
-
-/**
- * panel_frame_switcher_set_foreground_rgba:
- * @self: a #PanelFrameSwitcher
- * @foreground_rgba: (nullable): the foreground color
- *
- * Sets the foreground color of the switcher.
- */
-void
-panel_frame_switcher_set_foreground_rgba (PanelFrameSwitcher *self,
- const GdkRGBA *foreground_rgba)
-{
- g_return_if_fail (PANEL_IS_FRAME_SWITCHER (self));
-
- self->foreground_rgba_set = foreground_rgba != NULL;
- if (foreground_rgba)
- self->foreground_rgba = *foreground_rgba;
- panel_frame_switcher_queue_update_css (self);
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_FOREGROUND_RGBA]);
}
AdwTabPage *
diff --git a/src/panel-frame-switcher.h b/src/panel-frame-switcher.h
index 3f56110..5475a56 100644
--- a/src/panel-frame-switcher.h
+++ b/src/panel-frame-switcher.h
@@ -33,16 +33,6 @@ PANEL_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (PanelFrameSwitcher, panel_frame_switcher, PANEL, FRAME_SWITCHER, GtkWidget)
PANEL_AVAILABLE_IN_ALL
-GtkWidget *panel_frame_switcher_new (void);
-PANEL_AVAILABLE_IN_ALL
-const GdkRGBA *panel_frame_switcher_get_background_rgba (PanelFrameSwitcher *self);
-PANEL_AVAILABLE_IN_ALL
-const GdkRGBA *panel_frame_switcher_get_foreground_rgba (PanelFrameSwitcher *self);
-PANEL_AVAILABLE_IN_ALL
-void panel_frame_switcher_set_background_rgba (PanelFrameSwitcher *self,
- const GdkRGBA *background_rgba);
-PANEL_AVAILABLE_IN_ALL
-void panel_frame_switcher_set_foreground_rgba (PanelFrameSwitcher *self,
- const GdkRGBA *foreground_rgba);
+GtkWidget *panel_frame_switcher_new (void);
G_END_DECLS
diff --git a/src/panel-widget.c b/src/panel-widget.c
index c7e7b50..2078ae3 100644
--- a/src/panel-widget.c
+++ b/src/panel-widget.c
@@ -40,13 +40,8 @@ typedef struct
GtkWidget *maximize_frame;
GtkWidget *maximize_dock_child;
- GdkRGBA foreground_rgba;
- GdkRGBA background_rgba;
-
guint busy_count;
- guint background_rgba_set : 1;
- guint foreground_rgba_set : 1;
guint reorderable : 1;
guint can_maximize : 1;
guint maximized : 1;
@@ -62,11 +57,9 @@ G_DEFINE_TYPE_WITH_CODE (PanelWidget, panel_widget, GTK_TYPE_WIDGET,
enum {
PROP_0,
- PROP_BACKGROUND_RGBA,
PROP_BUSY,
PROP_CAN_MAXIMIZE,
PROP_CHILD,
- PROP_FOREGROUND_RGBA,
PROP_ICON,
PROP_ICON_NAME,
PROP_MENU_MODEL,
@@ -88,7 +81,6 @@ enum {
static GParamSpec *properties [N_PROPS];
static guint signals [N_SIGNALS];
-static const GdkRGBA transparent;
static void
panel_widget_update_actions (PanelWidget *self)
@@ -190,14 +182,6 @@ panel_widget_get_property (GObject *object,
switch (prop_id)
{
- case PROP_BACKGROUND_RGBA:
- g_value_set_boxed (value, panel_widget_get_background_rgba (self));
- break;
-
- case PROP_FOREGROUND_RGBA:
- g_value_set_boxed (value, panel_widget_get_foreground_rgba (self));
- break;
-
case PROP_BUSY:
g_value_set_boolean (value, panel_widget_get_busy (self));
break;
@@ -261,14 +245,6 @@ panel_widget_set_property (GObject *object,
switch (prop_id)
{
- case PROP_BACKGROUND_RGBA:
- panel_widget_set_background_rgba (self, g_value_get_boxed (value));
- break;
-
- case PROP_FOREGROUND_RGBA:
- panel_widget_set_foreground_rgba (self, g_value_get_boxed (value));
- break;
-
case PROP_CAN_MAXIMIZE:
panel_widget_set_can_maximize (self, g_value_get_boolean (value));
break;
@@ -331,40 +307,6 @@ panel_widget_class_init (PanelWidgetClass *klass)
widget_class->measure = panel_widget_measure;
widget_class->size_allocate = panel_widget_size_allocate;
- /**
- * PanelWidget:background-rgba:
- *
- * The "background-rgba" property denotes a background rgba color that is
- * similar to the widget's contents.
- *
- * This can be used by #PanelFrameHeader implementations to more closely
- * match the content with accent colors. #PanelFrameHeaderBar uses this
- * to match the background of the bar with the content.
- */
- properties [PROP_BACKGROUND_RGBA] =
- g_param_spec_boxed ("background-rgba",
- "Background RGBA",
- "Background RGBA",
- GDK_TYPE_RGBA,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
- /**
- * PanelWidget:foreground-rgba:
- *
- * The "foreground-rgba" property denotes a foreground rgba color that is
- * similar to the widget's contents.
- *
- * This can be used by #PanelFrameHeader implementations to more closely
- * match the content with accent colors. #PanelFrameHeaderBar uses this
- * to match the foreground of the bar with the content.
- */
- properties [PROP_FOREGROUND_RGBA] =
- g_param_spec_boxed ("foreground-rgba",
- "Foreground RGBA",
- "Foreground RGBA",
- GDK_TYPE_RGBA,
- (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS));
-
properties [PROP_BUSY] =
g_param_spec_boolean ("busy",
"Busy",
@@ -977,96 +919,6 @@ panel_widget_unmark_busy (PanelWidget *self)
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_BUSY]);
}
-/**
- * panel_widget_get_background_rgba:
- * @self: a #PanelWidget
- *
- * Gets the background color of the widget.
- *
- * Returns: (nullable): the background color
- */
-const GdkRGBA *
-panel_widget_get_background_rgba (PanelWidget *self)
-{
- PanelWidgetPrivate *priv = panel_widget_get_instance_private (self);
-
- g_return_val_if_fail (PANEL_IS_WIDGET (self), NULL);
-
- return priv->background_rgba_set ? &priv->background_rgba : NULL;
-}
-
-/**
- * panel_widget_set_background_rgba:
- * @self: a #PanelWidget
- * @background_rgba: (nullable): the background color
- *
- * Sets the background color of the widget.
- */
-void
-panel_widget_set_background_rgba (PanelWidget *self,
- const GdkRGBA *background_rgba)
-{
- PanelWidgetPrivate *priv = panel_widget_get_instance_private (self);
-
- g_return_if_fail (PANEL_IS_WIDGET (self));
-
- priv->background_rgba_set = background_rgba != NULL;
-
- if (background_rgba == NULL)
- background_rgba = &transparent;
-
- if (!gdk_rgba_equal (background_rgba, &priv->background_rgba))
- {
- priv->background_rgba = *background_rgba;
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_BACKGROUND_RGBA]);
- }
-}
-
-/**
- * panel_widget_get_foreground_rgba:
- * @self: a #PanelWidget
- *
- * Gets the foreground color of the widget.
- *
- * Returns: (nullable): the foreground color
- */
-const GdkRGBA *
-panel_widget_get_foreground_rgba (PanelWidget *self)
-{
- PanelWidgetPrivate *priv = panel_widget_get_instance_private (self);
-
- g_return_val_if_fail (PANEL_IS_WIDGET (self), NULL);
-
- return priv->foreground_rgba_set ? &priv->foreground_rgba : NULL;
-}
-
-/**
- * panel_widget_set_foreground_rgba:
- * @self: a #PanelWidget
- * @foreground_rgba: (nullable): the foreground color
- *
- * Sets the foreground color of the widget.
- */
-void
-panel_widget_set_foreground_rgba (PanelWidget *self,
- const GdkRGBA *foreground_rgba)
-{
- PanelWidgetPrivate *priv = panel_widget_get_instance_private (self);
-
- g_return_if_fail (PANEL_IS_WIDGET (self));
-
- priv->foreground_rgba_set = foreground_rgba != NULL;
-
- if (foreground_rgba == NULL)
- foreground_rgba = &transparent;
-
- if (!gdk_rgba_equal (foreground_rgba, &priv->foreground_rgba))
- {
- priv->foreground_rgba = *foreground_rgba;
- g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_FOREGROUND_RGBA]);
- }
-}
-
/**
* panel_widget_get_menu_model:
* @self: a #PanelWidget
diff --git a/src/panel-widget.h b/src/panel-widget.h
index 2e9efed..f161a2b 100644
--- a/src/panel-widget.h
+++ b/src/panel-widget.h
@@ -106,16 +106,6 @@ void panel_widget_mark_busy (PanelWidget *self);
PANEL_AVAILABLE_IN_ALL
void panel_widget_unmark_busy (PanelWidget *self);
PANEL_AVAILABLE_IN_ALL
-const GdkRGBA *panel_widget_get_foreground_rgba (PanelWidget *self);
-PANEL_AVAILABLE_IN_ALL
-void panel_widget_set_foreground_rgba (PanelWidget *self,
- const GdkRGBA *foreground_rgba);
-PANEL_AVAILABLE_IN_ALL
-const GdkRGBA *panel_widget_get_background_rgba (PanelWidget *self);
-PANEL_AVAILABLE_IN_ALL
-void panel_widget_set_background_rgba (PanelWidget *self,
- const GdkRGBA *background_rgba);
-PANEL_AVAILABLE_IN_ALL
GMenuModel *panel_widget_get_menu_model (PanelWidget *self);
PANEL_AVAILABLE_IN_ALL
void panel_widget_set_menu_model (PanelWidget *self,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]