[Xfce4-commits] [panel-plugins/xfce4-xkb-plugin] 02/02: Display warning tooltip if option is not available

noreply at xfce.org noreply at xfce.org
Wed Jul 26 21:30:25 CEST 2017


This is an automated email from the git hooks/post-receive script.

n   i   n   e   t   l   s       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-xkb-plugin.

commit 96c85fe35a38cfd6ee5610fef07a4e64b2879612
Author: Viktor Odintsev <zakhams at gmail.com>
Date:   Wed Jul 26 22:19:03 2017 +0300

    Display warning tooltip if option is not available
---
 panel-plugin/xkb-dialog.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/panel-plugin/xkb-dialog.c b/panel-plugin/xkb-dialog.c
index 1c63cac..926d4ff 100644
--- a/panel-plugin/xkb-dialog.c
+++ b/panel-plugin/xkb-dialog.c
@@ -63,6 +63,29 @@ xkb_dialog_transform_scale_range_for_caps_lock_indicator (GBinding     *binding,
 
 
 
+static gboolean
+xkb_dialog_set_style_warning_tooltip (GtkWidget *widget,
+                                      gint        x,
+                                      gint        y,
+                                      gboolean    keyboard_mode,
+                                      GtkTooltip *tooltip)
+{
+  if (!gtk_widget_get_sensitive (widget))
+    {
+      gtk_tooltip_set_text (tooltip,
+                            _("This option is not available for current layout style"));
+      gtk_tooltip_set_icon_from_icon_name (tooltip,
+                                           "dialog-warning-symbolic",
+                                           GTK_ICON_SIZE_SMALL_TOOLBAR);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+
+
 void
 xkb_dialog_configure_plugin (XfcePanelPlugin *plugin,
                              XkbXfconf       *config)
@@ -234,6 +257,14 @@ xkb_dialog_configure_plugin (XfcePanelPlugin *plugin,
                                xkb_dialog_transform_scale_range_for_caps_lock_indicator,
                                NULL, NULL, NULL);
 
+  gtk_widget_set_has_tooltip (display_scale_range, TRUE);
+  g_signal_connect (display_scale_range, "query-tooltip",
+                    G_CALLBACK (xkb_dialog_set_style_warning_tooltip), NULL);
+
+  gtk_widget_set_has_tooltip (caps_lock_indicator_switch, TRUE);
+  g_signal_connect (caps_lock_indicator_switch, "query-tooltip",
+                    G_CALLBACK (xkb_dialog_set_style_warning_tooltip), NULL);
+
   gtk_widget_show (settings_dialog);
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list