Merge lp:~3v1n0/unity/fix-style-overriding-deprecations into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3978
Proposed branch: lp:~3v1n0/unity/fix-style-overriding-deprecations
Merge into: lp:unity
Diff against target: 56 lines (+13/-12)
1 file modified
decorations/DecorationsForceQuitDialog.cpp (+13/-12)
To merge this branch: bzr merge lp:~3v1n0/unity/fix-style-overriding-deprecations
Reviewer Review Type Date Requested Status
Christopher Townsend (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+261840@code.launchpad.net

Commit message

DecorationsForceQuitDialog: remove deprecated override style functions, use CSS

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Yep, compiles now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'decorations/DecorationsForceQuitDialog.cpp'
2--- decorations/DecorationsForceQuitDialog.cpp 2015-02-03 10:47:59 +0000
3+++ decorations/DecorationsForceQuitDialog.cpp 2015-06-12 12:22:59 +0000
4@@ -168,7 +168,6 @@
5 auto* screen = gtk_window_get_screen(self);
6 gtk_widget_set_visual(GTK_WIDGET(self), gdk_screen_get_rgba_visual(screen));
7 gtk_widget_realize(GTK_WIDGET(self));
8- gtk_widget_override_background_color(GTK_WIDGET(self), GTK_STATE_FLAG_NORMAL, nullptr);
9
10 gtk_container_add(GTK_CONTAINER(self), sheet_style_dialog_new(main_dialog, parent_xid, parent_pid));
11
12@@ -316,9 +315,15 @@
13 gtk_container_add(GTK_CONTAINER(main_box), content_box);
14
15 auto* title = gtk_label_new(_("This window is not responding"));
16- auto* font_desc = pango_font_description_from_string("Ubuntu 17");
17- gtk_widget_override_font(title, font_desc);
18- pango_font_description_free(font_desc);
19+ glib::Object<GtkCssProvider> title_style(gtk_css_provider_new());
20+ gtk_css_provider_load_from_data(title_style, (R"(
21+ GtkLabel {
22+ font-size: 17px;
23+ })"), -1, nullptr);
24+ style_ctx = gtk_widget_get_style_context(title);
25+ gtk_style_context_add_provider(style_ctx, glib::object_cast<GtkStyleProvider>(title_style), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
26+ gtk_style_context_add_class(style_ctx, "unity-force-quit");
27+
28 gtk_widget_set_halign(title, GTK_ALIGN_START);
29 gtk_box_pack_start(GTK_BOX(content_box), title, FALSE, FALSE, 0);
30
31@@ -330,6 +335,9 @@
32 gtk_box_set_spacing(GTK_BOX(buttons_box), 15);
33 gtk_container_set_border_width(GTK_CONTAINER(buttons_box), 5);
34 gtk_button_box_set_layout(GTK_BUTTON_BOX(buttons_box), GTK_BUTTONBOX_END);
35+ gtk_widget_set_halign(GTK_WIDGET(buttons_box), GTK_ALIGN_END);
36+ gtk_widget_set_valign(GTK_WIDGET(buttons_box), GTK_ALIGN_END);
37+ gtk_widget_set_margin_top(GTK_WIDGET(buttons_box), 20);
38
39 auto* wait_button = gtk_button_new_with_mnemonic(_("_Wait"));
40 gtk_container_add(GTK_CONTAINER(buttons_box), wait_button);
41@@ -344,14 +352,7 @@
42 kill_data, [] (gpointer data, GClosure*) { g_free(data); },
43 static_cast<GConnectFlags>(0));
44
45- // FIXME Look at moving to non deprecated functions
46- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
47- auto* buttons_aligment = gtk_alignment_new(1, 1, 0, 0);
48- gtk_alignment_set_padding(GTK_ALIGNMENT(buttons_aligment), 20, 0, 0, 0);
49- gtk_container_add(GTK_CONTAINER(buttons_aligment), buttons_box);
50- gtk_container_add(GTK_CONTAINER(content_box), buttons_aligment);
51- G_GNUC_END_IGNORE_DEPRECATIONS
52-
53+ gtk_container_add(GTK_CONTAINER(content_box), buttons_box);
54 gtk_container_add(GTK_CONTAINER(self), main_box);
55
56 return self;