summaryrefslogtreecommitdiff
path: root/mate-window-picker-applet/task-title.c
diff options
context:
space:
mode:
authorÉtienne Deparis <[email protected]>2019-04-29 13:52:20 +0200
committerMartin Wimpress <[email protected]>2019-09-23 19:48:37 +0100
commit0a930323e0c41948aefe57729bda98af455ba8e8 (patch)
tree08641533c8cb9215b648903c8854f92f4f7cd821 /mate-window-picker-applet/task-title.c
parentafcebfe95c649b1dc57370beec671cc32d63b9aa (diff)
downloadmate-netbook-0a930323e0c41948aefe57729bda98af455ba8e8.tar.bz2
mate-netbook-0a930323e0c41948aefe57729bda98af455ba8e8.tar.xz
Add an option to disable the bold face of the window title in applet
Diffstat (limited to 'mate-window-picker-applet/task-title.c')
-rw-r--r--mate-window-picker-applet/task-title.c57
1 files changed, 50 insertions, 7 deletions
diff --git a/mate-window-picker-applet/task-title.c b/mate-window-picker-applet/task-title.c
index 15c4247..1f0ed7c 100644
--- a/mate-window-picker-applet/task-title.c
+++ b/mate-window-picker-applet/task-title.c
@@ -45,13 +45,15 @@ struct _TaskTitlePrivate
GdkPixbuf *quit_icon;
gboolean show_home_title;
+ gboolean bold_window_title;
gboolean mouse_in_close_button;
};
enum
{
PROP_0,
- PROP_SHOW_HOME_TITLE
+ PROP_SHOW_HOME_TITLE,
+ PROP_BOLD_WINDOW_TITLE
};
static void disconnect_window (TaskTitle *title);
@@ -431,6 +433,29 @@ task_title_set_show_home_title (TaskTitle *title, gboolean show_home_title)
}
static void
+task_title_set_bold_window_title (TaskTitle *title, gboolean bold_window_title)
+{
+ TaskTitlePrivate *priv = title->priv;
+
+ priv->bold_window_title = bold_window_title;
+
+ g_debug ("Bold window title: %s", bold_window_title ? "true" : "false");
+
+ PangoAttribute *attr;
+ PangoAttrList *attr_list = pango_attr_list_new ();
+ if (priv->bold_window_title)
+ {
+ attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
+ }
+ else
+ {
+ attr = pango_attr_weight_new (PANGO_WEIGHT_NORMAL);
+ }
+ pango_attr_list_insert (attr_list, attr);
+ gtk_label_set_attributes (GTK_LABEL (priv->label), attr_list);
+}
+
+static void
task_title_get_property (GObject *object,
guint prop_id,
GValue *value,
@@ -447,6 +472,9 @@ task_title_get_property (GObject *object,
case PROP_SHOW_HOME_TITLE:
g_value_set_boolean (value, priv->show_home_title);
break;
+ case PROP_BOLD_WINDOW_TITLE:
+ g_value_set_boolean (value, priv->bold_window_title);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -467,6 +495,9 @@ task_title_set_property (GObject *object,
case PROP_SHOW_HOME_TITLE:
task_title_set_show_home_title (title, g_value_get_boolean (value));
break;
+ case PROP_BOLD_WINDOW_TITLE:
+ task_title_set_bold_window_title (title, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -503,6 +534,14 @@ task_title_class_init (TaskTitleClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (obj_class,
+ PROP_BOLD_WINDOW_TITLE,
+ g_param_spec_boolean ("bold_window_title",
+ "Bold Window Title",
+ "Show windows title with a bold face",
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
wid_class->draw = on_draw;
g_type_class_add_private (obj_class, sizeof (TaskTitlePrivate));
@@ -525,6 +564,7 @@ task_title_init (TaskTitle *title)
// Default values
priv->show_home_title = FALSE;
+ priv->bold_window_title = TRUE;
gtk_widget_add_events (GTK_WIDGET (title), GDK_ALL_EVENTS_MASK);
@@ -542,12 +582,15 @@ task_title_init (TaskTitle *title)
gtk_label_set_ellipsize (GTK_LABEL (priv->label), PANGO_ELLIPSIZE_END);
gtk_widget_set_halign (priv->label, GTK_ALIGN_START);
gtk_widget_set_valign (priv->label, GTK_ALIGN_CENTER);
-
- PangoAttrList *attr_list = pango_attr_list_new ();
- PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
- pango_attr_list_insert (attr_list, attr);
- gtk_label_set_attributes (GTK_LABEL (priv->label), attr_list);
-
+
+ if (priv->bold_window_title)
+ {
+ PangoAttrList *attr_list = pango_attr_list_new ();
+ PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
+ pango_attr_list_insert (attr_list, attr);
+ gtk_label_set_attributes (GTK_LABEL (priv->label), attr_list);
+ }
+
gtk_box_pack_start (GTK_BOX (priv->box), priv->label, TRUE, TRUE, 0);
gtk_widget_show (priv->label);