[Xfce4-commits] <xfce4-weather-plugin:master> Allow removing applied scrollbox font by middle-click.

Harald Judt noreply at xfce.org
Tue Nov 27 16:46:31 CET 2012


Updating branch refs/heads/master
         to dfadb1590ab1c183d6e298923deb7fd1aaa6c4ed (commit)
       from 2d7b86da82655536695a8b2e6ed00befc123e6e9 (commit)

commit dfadb1590ab1c183d6e298923deb7fd1aaa6c4ed
Author: Harald Judt <h.judt at gmx.at>
Date:   Mon Nov 26 12:49:14 2012 +0100

    Allow removing applied scrollbox font by middle-click.

 panel-plugin/weather-config.c    |   26 ++++++++++++++++++++++++++
 panel-plugin/weather-scrollbox.c |    3 ---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 2108933..ac6cce7 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -791,6 +791,28 @@ spin_scrollbox_lines_value_changed(const GtkWidget *spin,
 
 
 static gboolean
+button_scrollbox_font_pressed(GtkWidget *button,
+                              GdkEventButton *event,
+                              gpointer user_data)
+{
+    xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
+
+    if (event->type != GDK_BUTTON_PRESS)
+        return FALSE;
+
+    if (event->button == 2) {
+        g_free(dialog->wd->scrollbox_font);
+        dialog->wd->scrollbox_font = NULL;
+        gtk_scrollbox_set_fontname(GTK_SCROLLBOX(dialog->wd->scrollbox),
+                                   NULL);
+        gtk_button_set_label(GTK_BUTTON(button), _("Select _font"));
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+static gboolean
 button_scrollbox_font_clicked(GtkWidget *button,
                               gpointer user_data)
 {
@@ -1075,6 +1097,10 @@ create_scrollbox_page(xfceweather_dialog *dialog)
     if (dialog->wd->scrollbox_font)
         gtk_button_set_label(GTK_BUTTON(dialog->button_scrollbox_font),
                              dialog->wd->scrollbox_font);
+    g_signal_connect(G_OBJECT(dialog->button_scrollbox_font),
+                     "button_press_event",
+                     G_CALLBACK(button_scrollbox_font_pressed),
+                     dialog);
     g_signal_connect(dialog->button_scrollbox_font, "clicked",
                      G_CALLBACK(button_scrollbox_font_clicked), dialog);
     dialog->button_scrollbox_color =
diff --git a/panel-plugin/weather-scrollbox.c b/panel-plugin/weather-scrollbox.c
index 0946253..350b444 100644
--- a/panel-plugin/weather-scrollbox.c
+++ b/panel-plugin/weather-scrollbox.c
@@ -365,9 +365,6 @@ gtk_scrollbox_set_fontname(GtkScrollbox *self,
 {
     g_return_if_fail(GTK_IS_SCROLLBOX(self));
 
-    if (fontname == NULL)
-        return;
-
     g_free(self->fontname);
     self->fontname = g_strdup(fontname);
 


More information about the Xfce4-commits mailing list