[Xfce4-commits] <xfce4-notifyd:master> add summary-bold style property (bug 5773)

Brian J. Tarricone noreply at xfce.org
Sat Sep 19 11:06:01 CEST 2009


Updating branch refs/heads/master
         to dba1153a5ff5cf859ef8d4be7b92da0303204690 (commit)
       from caad017fc9891b64668feec5bc94412045b79801 (commit)

commit dba1153a5ff5cf859ef8d4be7b92da0303204690
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Sat Sep 19 02:03:54 2009 -0700

    add summary-bold style property (bug 5773)

 NEWS                               |    2 ++
 xfce4-notifyd/xfce-notify-window.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 5807de5..1241651 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ Version 0.1.0git:
       xfce4-notifyd).  In this case, you should compile xfce4-notifyd
       passing the --enable-old-notification-closed-signature switch
       to configure.
+    * Add summary-bold style property to allow themes to set the
+      summary field of the notification bold (bug 5773).
 
   Bugfixes:
     * Fix ugliness with rounded corners on windows sometimes, both with
diff --git a/xfce4-notifyd/xfce-notify-window.c b/xfce4-notifyd/xfce-notify-window.c
index c09b2fe..3c43dfb 100644
--- a/xfce4-notifyd/xfce-notify-window.c
+++ b/xfce4-notifyd/xfce-notify-window.c
@@ -110,6 +110,8 @@ static gboolean xfce_notify_window_motion_notify(GtkWidget *widget,
                                                  GdkEventMotion *evt);
 static gboolean xfce_notify_window_configure_event(GtkWidget *widget,
                                                    GdkEventConfigure *evt);
+static void xfce_notify_window_style_set(GtkWidget *widget,
+                                         GtkStyle *previous_style);
 
 static gboolean xfce_notify_window_expire_timeout(gpointer data);
 static gboolean xfce_notify_window_fade_timeout(gpointer data);
@@ -146,6 +148,7 @@ xfce_notify_window_class_init(XfceNotifyWindowClass *klass)
     widget_class->button_release_event = xfce_notify_window_button_release;
     widget_class->motion_notify_event = xfce_notify_window_motion_notify;
     widget_class->configure_event = xfce_notify_window_configure_event;
+    widget_class->style_set = xfce_notify_window_style_set;
 
     signals[SIG_CLOSED] = g_signal_new("closed",
                                        XFCE_TYPE_NOTIFY_WINDOW,
@@ -188,6 +191,12 @@ xfce_notify_window_class_init(XfceNotifyWindowClass *klass)
                                                                 0.0, 8.0,
                                                                 DEFAULT_BORDER_WIDTH,
                                                                 G_PARAM_READABLE));
+    gtk_widget_class_install_style_property(widget_class,
+                                            g_param_spec_boolean("summary-bold",
+                                                                 "summary bold",
+                                                                 "whether or not to display the notification summary field in bold text",
+                                                                 FALSE,
+                                                                 G_PARAM_READABLE));
 }
 
 static void
@@ -690,6 +699,27 @@ xfce_notify_window_configure_event(GtkWidget *widget,
     return ret;
 }
 
+static void
+xfce_notify_window_style_set(GtkWidget *widget,
+                             GtkStyle *previous_style)
+{
+    XfceNotifyWindow *window = XFCE_NOTIFY_WINDOW(widget);
+    gboolean summary_bold = FALSE;
+    GtkStyle *style;
+    PangoFontDescription *pfd;
+
+    gtk_widget_style_get(widget,
+                         "summary-bold", &summary_bold,
+                         NULL);
+    if(summary_bold) {
+        style = gtk_widget_get_style(window->summary);
+        pfd = pango_font_description_copy(style->font_desc);
+        pango_font_description_set_weight(pfd, PANGO_WEIGHT_BOLD);
+        gtk_widget_modify_font(window->summary, pfd);
+        pango_font_description_free(pfd);
+    }
+}
+
 
 
 static gboolean



More information about the Xfce4-commits mailing list