summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Ulbrich <[email protected]>2015-11-30 00:33:41 +0100
committerWolfgang Ulbrich <[email protected]>2015-12-01 21:50:40 +0100
commit346e96a1be7bc54d1bc63fa45ab81df19a02b687 (patch)
tree1cf8ef213b632b0fb7940a7586eeea5f51e312d4
parent4534e68bb0cb31734be338efa06cb6d3e00180f6 (diff)
downloadmate-system-monitor-346e96a1be7bc54d1bc63fa45ab81df19a02b687.tar.bz2
mate-system-monitor-346e96a1be7bc54d1bc63fa45ab81df19a02b687.tar.xz
GTK3: do not use deprecated GtkMisc
-rw-r--r--src/interface.cpp52
-rw-r--r--src/procdialogs.cpp36
-rw-r--r--src/sysinfo.cpp28
-rw-r--r--src/util.cpp4
4 files changed, 120 insertions, 0 deletions
diff --git a/src/interface.cpp b/src/interface.cpp
index d981c9a..f4f5b81 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -256,7 +256,11 @@ make_title_label (const char *text)
label = gtk_label_new (full);
g_free (full);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+#endif
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
return label;
@@ -351,7 +355,11 @@ create_sys_view (ProcData *procdata)
g_free (label_text);
cpu_label = gtk_label_new (NULL);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (cpu_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (cpu_label), 0.0, 0.5);
+#endif
gtk_box_pack_start (GTK_BOX (temp_hbox), cpu_label, TRUE, TRUE, 0);
load_graph_get_labels(cpu_graph)->cpu[i] = cpu_label;
@@ -407,7 +415,11 @@ create_sys_view (ProcData *procdata)
label = gtk_label_new (label_text);
g_free(label_text);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_table_attach (GTK_TABLE (table), label, 1, 7, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table),
@@ -438,7 +450,11 @@ create_sys_view (ProcData *procdata)
label = gtk_label_new (label_text);
g_free(label_text);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_table_attach (GTK_TABLE (table), label, 1, 7, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach (GTK_TABLE (table),
@@ -504,24 +520,42 @@ create_sys_view (ProcData *procdata)
label = gtk_label_new (label_text);
g_free(label_text);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (load_graph_get_labels(net_graph)->net_in, GTK_ALIGN_END);
+ gtk_widget_set_valign (load_graph_get_labels(net_graph)->net_in, GTK_ALIGN_CENTER);
+#else
gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_in),
1.0,
0.5);
+#endif
gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_in), 100, -1);
gtk_table_attach (GTK_TABLE (table), load_graph_get_labels(net_graph)->net_in, 2, 3, 0, 1,
static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL), GTK_FILL, 0, 0);
label = gtk_label_new (_("Total Received"));
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (load_graph_get_labels(net_graph)->net_in_total, GTK_ALIGN_END);
+ gtk_widget_set_valign (load_graph_get_labels(net_graph)->net_in_total, GTK_ALIGN_CENTER);
+#else
gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_in_total),
1.0,
0.5);
+#endif
gtk_table_attach (GTK_TABLE (table),
load_graph_get_labels(net_graph)->net_in_total,
2,
@@ -556,24 +590,42 @@ create_sys_view (ProcData *procdata)
label = gtk_label_new (label_text);
g_free(label_text);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (load_graph_get_labels(net_graph)->net_out, GTK_ALIGN_END);
+ gtk_widget_set_valign (load_graph_get_labels(net_graph)->net_out, GTK_ALIGN_CENTER);
+#else
gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_out),
1.0,
0.5);
+#endif
gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_out), 100, -1);
gtk_table_attach (GTK_TABLE (table), load_graph_get_labels(net_graph)->net_out, 2, 3, 0, 1,
static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL), GTK_FILL, 0, 0);
label = gtk_label_new (_("Total Sent"));
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (load_graph_get_labels(net_graph)->net_out_total, GTK_ALIGN_END);
+ gtk_widget_set_valign (load_graph_get_labels(net_graph)->net_out_total, GTK_ALIGN_CENTER);
+#else
gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_out_total),
1.0,
0.5);
+#endif
gtk_table_attach (GTK_TABLE (table),
load_graph_get_labels(net_graph)->net_out_total,
2,
diff --git a/src/procdialogs.cpp b/src/procdialogs.cpp
index 0f29c14..001b9b6 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -417,7 +417,11 @@ create_field_page(GtkWidget *tree, const char* text)
vbox = gtk_vbox_new (FALSE, 6);
label = gtk_label_new_with_mnemonic (text);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
scrolled = gtk_scrolled_window_new (NULL, NULL);
@@ -560,7 +564,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("Behavior"));
label = gtk_label_new (NULL);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_label_set_markup (GTK_LABEL (label), tmp);
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
@@ -578,7 +586,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Update interval in seconds:"));
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
hbox3 = gtk_hbox_new (FALSE, 6);
@@ -648,7 +660,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("Information Fields"));
label = gtk_label_new (NULL);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_label_set_markup (GTK_LABEL (label), tmp);
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
@@ -673,7 +689,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("Graphs"));
label = gtk_label_new (NULL);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_label_set_markup (GTK_LABEL (label), tmp);
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, FALSE, 0);
@@ -691,7 +711,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Update interval in seconds:"));
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
gtk_size_group_add_widget (size, label);
@@ -735,7 +759,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("File Systems"));
label = gtk_label_new (NULL);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_label_set_markup (GTK_LABEL (label), tmp);
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
@@ -753,7 +781,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic (_("_Update interval in seconds:"));
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
hbox3 = gtk_hbox_new (FALSE, 6);
@@ -788,7 +820,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("Information Fields"));
label = gtk_label_new (NULL);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_label_set_markup (GTK_LABEL (label), tmp);
g_free (tmp);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index 16a34aa..4884960 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -726,7 +726,11 @@ add_row(GtkTable * table, const char * label, const char * value, int row)
GtkWidget *header = gtk_label_new(NULL);
gtk_label_set_markup(GTK_LABEL(header), label);
gtk_label_set_selectable(GTK_LABEL(header), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (header, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment(GTK_MISC(header), 0.0, 0.5);
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
table, header,
@@ -741,7 +745,11 @@ add_row(GtkTable * table, const char * label, const char * value, int row)
GtkWidget *label_widget = gtk_label_new(value);
gtk_label_set_selectable(GTK_LABEL(label_widget), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label_widget, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment(GTK_MISC(label_widget), 0.0, 0.5);
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
table, label_widget,
@@ -788,8 +796,16 @@ procman_create_sysinfo_view(void)
else {
logo = gtk_image_new_from_file(DATADIR "/pixmaps/mate-system-monitor/side.png");
}
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_valign (logo, GTK_ALIGN_START);
+ gtk_widget_set_margin_start (logo, 5);
+ gtk_widget_set_margin_end (logo, 5);
+ gtk_widget_set_margin_top (logo, 12);
+ gtk_widget_set_margin_bottom (logo, 12);
+#else
gtk_misc_set_alignment(GTK_MISC(logo), 0.5, 0.0);
gtk_misc_set_padding(GTK_MISC(logo), 5, 12);
+#endif
gtk_box_pack_start(GTK_BOX(hbox), logo, FALSE, FALSE, 0);
#if GTK_CHECK_VERSION(3,0,0)
@@ -828,7 +844,11 @@ procman_create_sysinfo_view(void)
distro_release_label = gtk_label_new("???");
gtk_label_set_selectable(GTK_LABEL(distro_release_label), TRUE);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (distro_release_label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment(GTK_MISC(distro_release_label), 0.0, 0.5);
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
GTK_GRID(distro_table), distro_release_label,
@@ -847,7 +867,11 @@ procman_create_sysinfo_view(void)
header = gtk_label_new(markup);
gtk_label_set_selectable(GTK_LABEL(header), TRUE);
g_free(markup);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (header, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment(GTK_MISC(header), 0.0, 0.5);
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
GTK_GRID(distro_table), header,
@@ -867,7 +891,11 @@ procman_create_sysinfo_view(void)
header = gtk_label_new(markup);
gtk_label_set_selectable(GTK_LABEL(header), TRUE);
g_free(markup);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (header, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment(GTK_MISC(header), 0.0, 0.5);
+#endif
#if GTK_CHECK_VERSION (3, 0, 0)
gtk_grid_attach(
GTK_GRID(distro_table), header,
diff --git a/src/util.cpp b/src/util.cpp
index 0690d48..20714bd 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -125,7 +125,11 @@ procman_make_label_for_mmaps_or_ofiles(const char *format,
name = mnemonic_safe_process_name (process_name);
title = g_strdup_printf(format, name, pid);
label = gtk_label_new_with_mnemonic (title);
+#if GTK_CHECK_VERSION (3, 14, 0)
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+#else
gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f);
+#endif
g_free (title);
g_free (name);