[libpanel] frame-switcher: setup tooltip for switcher buttons
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpanel] frame-switcher: setup tooltip for switcher buttons
- Date: Tue, 27 Sep 2022 04:41:49 +0000 (UTC)
commit 3a2634001c493089af52202249ed279ecb579fe3
Author: Christian Hergert <chergert redhat com>
Date: Mon Sep 26 21:41:17 2022 -0700
frame-switcher: setup tooltip for switcher buttons
src/panel-frame-switcher.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/panel-frame-switcher.c b/src/panel-frame-switcher.c
index 44c1243..e5681b3 100644
--- a/src/panel-frame-switcher.c
+++ b/src/panel-frame-switcher.c
@@ -172,7 +172,8 @@ on_button_toggled (GtkWidget *button,
static void
rebuild_child (GtkWidget *self,
GIcon *icon,
- const char *title)
+ const char *title,
+ const char *tooltip)
{
GtkWidget *button_child;
@@ -197,6 +198,8 @@ rebuild_child (GtkWidget *self,
gtk_widget_add_css_class (self, "text-button");
}
+ gtk_widget_set_tooltip_text (self, tooltip);
+
if (button_child)
{
gtk_widget_set_halign (GTK_WIDGET (button_child), GTK_ALIGN_CENTER);
@@ -214,6 +217,7 @@ update_button (PanelFrameSwitcher *self,
GtkWidget *button)
{
char *title = NULL;
+ char *tooltip = NULL;
GIcon *icon = NULL;
gboolean needs_attention = FALSE;
@@ -225,9 +229,10 @@ update_button (PanelFrameSwitcher *self,
"title", &title,
"icon", &icon,
"needs-attention", &needs_attention,
+ "tooltip", &tooltip,
NULL);
- rebuild_child (button, icon, title);
+ rebuild_child (button, icon, title, tooltip);
gtk_widget_set_visible (button, (title != NULL || icon != NULL));
@@ -237,6 +242,7 @@ update_button (PanelFrameSwitcher *self,
gtk_widget_remove_css_class (button, "needs-attention");
g_free (title);
+ g_free (tooltip);
g_clear_object (&icon);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]