[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 03/03: Fix blurry category buttons with high DPI.

noreply at xfce.org noreply at xfce.org
Fri Oct 13 14:52:39 CEST 2017


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

g   o   t   t   c   o   d   e       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-whiskermenu-plugin.

commit 358dd0e61135f96d615d3688116250eb9f215205
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Oct 12 18:26:49 2017 -0400

    Fix blurry category buttons with high DPI.
---
 panel-plugin/section-button.cpp | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/panel-plugin/section-button.cpp b/panel-plugin/section-button.cpp
index 095e10b..ea217d4 100644
--- a/panel-plugin/section-button.cpp
+++ b/panel-plugin/section-button.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2016 Graeme Gott <graeme at gottcode.org>
+ * Copyright (C) 2013, 2016, 2017 Graeme Gott <graeme at gottcode.org>
  *
  * This library is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -62,7 +62,18 @@ SectionButton::SectionButton(const gchar* icon, const gchar* text) :
 	m_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4));
 	gtk_container_add(GTK_CONTAINER(m_button), GTK_WIDGET(m_box));
 
-	m_icon = xfce_panel_image_new();
+	if (!g_path_is_absolute(icon))
+	{
+		m_icon = gtk_image_new_from_icon_name(icon, GTK_ICON_SIZE_BUTTON);
+	}
+	else
+	{
+		GFile* file = g_file_new_for_path(icon);
+		GIcon* gicon = g_file_icon_new(file);
+		m_icon = gtk_image_new_from_gicon(gicon, GTK_ICON_SIZE_BUTTON);
+		g_object_unref(gicon);
+		g_object_unref(file);
+	}
 	gtk_box_pack_start(m_box, m_icon, false, false, 0);
 
 	m_label = gtk_label_new(text);
@@ -83,13 +94,9 @@ SectionButton::~SectionButton()
 
 void SectionButton::reload_icon_size()
 {
-	xfce_panel_image_clear(XFCE_PANEL_IMAGE(m_icon));
 	int size = wm_settings->category_icon_size.get_size();
-	xfce_panel_image_set_size(XFCE_PANEL_IMAGE(m_icon), size);
-	if (size > 1)
-	{
-		xfce_panel_image_set_from_source(XFCE_PANEL_IMAGE(m_icon), m_icon_name);
-	}
+	gtk_image_set_pixel_size(GTK_IMAGE(m_icon), size);
+	gtk_widget_set_visible(m_icon, size > 1);
 
 	if (wm_settings->category_show_name)
 	{

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


More information about the Xfce4-commits mailing list