summaryrefslogtreecommitdiff
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
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
-rw-r--r--mate-netbook.pot10
-rw-r--r--mate-window-picker-applet/applet.c37
-rw-r--r--mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in5
-rw-r--r--mate-window-picker-applet/task-title.c57
4 files changed, 102 insertions, 7 deletions
diff --git a/mate-netbook.pot b/mate-netbook.pot
index 9ebfcbb..718689b 100644
--- a/mate-netbook.pot
+++ b/mate-netbook.pot
@@ -39,6 +39,16 @@ msgid ""
"button."
msgstr ""
+#: ../mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in.h:5
+#: ../mate-window-picker-applet/applet.c:338
+msgid "Bold windows title"
+msgstr ""
+
+#: ../mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in.h:6
+#: ../mate-window-picker-applet/applet.c:340
+msgid "Show windows title with a bold face."
+msgstr ""
+
#: ../mate-window-picker-applet/org.mate.panel.MateWindowPicker.mate-panel-applet.in.in.h:1
msgid "Window Picker Applet Factory"
msgstr ""
diff --git a/mate-window-picker-applet/applet.c b/mate-window-picker-applet/applet.c
index 8f06693..34408c0 100644
--- a/mate-window-picker-applet/applet.c
+++ b/mate-window-picker-applet/applet.c
@@ -41,6 +41,7 @@
#define APPLET_SCHEMA "org.mate.panel.applet.mate-window-picker-applet"
#define SHOW_WIN_KEY "show-all-windows"
#define SHOW_HOME_TITLE_KEY "show-home-title"
+#define BOLD_WINDOW_TITLE_KEY "bold-window-title"
typedef struct
{
@@ -104,6 +105,20 @@ on_show_home_title_changed (GSettings *settings,
g_object_set (app->title, "show_home_title", show_home, NULL);
}
+static void
+on_bold_window_title_changed (GSettings *settings,
+ gchar *key,
+ gpointer data)
+{
+ WinPickerApp *app;
+ gboolean bold_win = TRUE;
+
+ app = (WinPickerApp*)data;
+
+ bold_win = g_settings_get_boolean (settings, BOLD_WINDOW_TITLE_KEY);
+ g_object_set (app->title, "bold_window_title", bold_win, NULL);
+}
+
static inline void
force_no_focus_padding (GtkWidget *widget)
{
@@ -171,6 +186,8 @@ cw_applet_fill (MatePanelApplet *applet,
G_CALLBACK (on_show_all_windows_changed), app);
g_signal_connect (app->settings, "changed::" SHOW_HOME_TITLE_KEY,
G_CALLBACK (on_show_home_title_changed), app);
+ g_signal_connect (app->settings, "changed::" BOLD_WINDOW_TITLE_KEY,
+ G_CALLBACK (on_bold_window_title_changed), app);
app->applet = GTK_WIDGET (applet);
force_no_focus_padding (GTK_WIDGET (applet));
@@ -190,6 +207,7 @@ cw_applet_fill (MatePanelApplet *applet,
on_show_all_windows_changed (app->settings, SHOW_WIN_KEY, app);
on_show_home_title_changed (app->settings, SHOW_HOME_TITLE_KEY, app);
+ on_bold_window_title_changed (app->settings, BOLD_WINDOW_TITLE_KEY, app);
action_group = gtk_action_group_new ("MateWindowPicker Applet Actions");
gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE);
@@ -266,6 +284,16 @@ on_show_home_title_checkbox_toggled (GtkToggleButton *check, gpointer null)
}
static void
+on_bold_window_title_checkbox_toggled (GtkToggleButton *check, gpointer null)
+{
+ gboolean is_active;
+
+ is_active = gtk_toggle_button_get_active (check);
+
+ g_settings_set_boolean (mainapp->settings, BOLD_WINDOW_TITLE_KEY, is_active);
+}
+
+static void
display_prefs_dialog (GtkAction *action,
WinPickerApp *applet)
{
@@ -307,6 +335,15 @@ display_prefs_dialog (GtkAction *action,
g_signal_connect (check, "toggled",
G_CALLBACK (on_show_home_title_checkbox_toggled), NULL);
+ check = gtk_check_button_new_with_label (_("Bold windows title"));
+ gtk_widget_set_tooltip_text (GTK_WIDGET (check),
+ _("Show windows title with a bold face."));
+ gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
+ g_settings_get_boolean (mainapp->settings, BOLD_WINDOW_TITLE_KEY));
+ g_signal_connect (check, "toggled",
+ G_CALLBACK (on_bold_window_title_checkbox_toggled), NULL);
+
check = gtk_label_new (" ");
gtk_box_pack_start (GTK_BOX (vbox), check, TRUE, TRUE, 0);
diff --git a/mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in b/mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in
index f3af64c..ca69d62 100644
--- a/mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in
+++ b/mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml.in
@@ -10,5 +10,10 @@
<summary>Show desktop title and logout button</summary>
<description>Show a title for the desktop when no window is selected, and append a logout button.</description>
</key>
+ <key name="bold-window-title" type="b">
+ <default>true</default>
+ <summary>Bold windows title</summary>
+ <description>Show windows title with a bold face.</description>
+ </key>
</schema>
</schemalist>
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);