summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-01-28 16:12:08 +0300
committermonsta <[email protected]>2016-02-08 16:13:14 +0300
commit7de773a2060f70968eddf1562e33ff3a2b4fd5f0 (patch)
tree475a8b0117fec71093367ba3845c2e3b524987ae /src
parent406e9c33b9434ce398177a1137567e8c7abb78c8 (diff)
downloadmate-system-monitor-7de773a2060f70968eddf1562e33ff3a2b4fd5f0.tar.bz2
mate-system-monitor-7de773a2060f70968eddf1562e33ff3a2b4fd5f0.tar.xz
use x/y align functions for GtkLabel with GTK+ >= 3.16
Conflicts: src/interface.cpp src/procdialogs.cpp src/sysinfo.cpp src/util.cpp
Diffstat (limited to 'src')
-rw-r--r--src/interface.cpp84
-rw-r--r--src/procdialogs.cpp54
-rw-r--r--src/sysinfo.cpp30
-rw-r--r--src/util.cpp6
4 files changed, 143 insertions, 31 deletions
diff --git a/src/interface.cpp b/src/interface.cpp
index e73c313..ca18c63 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -251,7 +251,11 @@ make_title_label (const char *text)
label = gtk_label_new (full);
g_free (full);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
return label;
@@ -346,7 +350,11 @@ create_sys_view (ProcData *procdata)
g_free (label_text);
cpu_label = gtk_label_new (NULL);
- gtk_widget_set_halign (cpu_label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (cpu_label), 0.0);
+#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;
@@ -402,7 +410,11 @@ create_sys_view (ProcData *procdata)
label = gtk_label_new (label_text);
g_free(label_text);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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),
@@ -433,7 +445,11 @@ create_sys_view (ProcData *procdata)
label = gtk_label_new (label_text);
g_free(label_text);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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),
@@ -499,22 +515,40 @@ create_sys_view (ProcData *procdata)
label = gtk_label_new (label_text);
g_free(label_text);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
- 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);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (load_graph_get_labels(net_graph)->net_in), 1.0);
+#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"));
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
- 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);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (load_graph_get_labels(net_graph)->net_in_total), 1.0);
+#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,
@@ -549,22 +583,40 @@ create_sys_view (ProcData *procdata)
label = gtk_label_new (label_text);
g_free(label_text);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
- 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);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (load_graph_get_labels(net_graph)->net_out), 1.0);
+#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"));
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
- 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);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (load_graph_get_labels(net_graph)->net_out_total), 1.0);
+#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 b7893c2..7789059 100644
--- a/src/procdialogs.cpp
+++ b/src/procdialogs.cpp
@@ -405,7 +405,11 @@ create_field_page(GtkWidget *tree, const char* text)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
label = gtk_label_new_with_mnemonic (text);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
@@ -548,7 +552,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("Behavior"));
label = gtk_label_new (NULL);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
@@ -566,7 +574,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:"));
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
@@ -636,7 +648,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("Information Fields"));
label = gtk_label_new (NULL);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
@@ -661,7 +677,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("Graphs"));
label = gtk_label_new (NULL);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
@@ -679,7 +699,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:"));
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
@@ -723,7 +747,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("File Systems"));
label = gtk_label_new (NULL);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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);
@@ -741,7 +769,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:"));
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
@@ -776,7 +808,11 @@ procdialog_create_preferences_dialog (ProcData *procdata)
tmp = g_strdup_printf ("<b>%s</b>", _("Information Fields"));
label = gtk_label_new (NULL);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#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 6e8e122..e5e0546 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -708,14 +708,22 @@ add_row(GtkGrid * 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);
- gtk_widget_set_halign (header, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (header), 0.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5);
+#endif
gtk_grid_attach(
table, header,
0, row, 1, 1);
GtkWidget *label_widget = gtk_label_new(value);
gtk_label_set_selectable(GTK_LABEL(label_widget), TRUE);
- gtk_widget_set_halign (label_widget, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label_widget), 0.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
+#endif
gtk_grid_attach(
table, label_widget,
1, row, 1, 1);
@@ -794,7 +802,11 @@ procman_create_sysinfo_view(void)
distro_release_label = gtk_label_new("???");
gtk_label_set_selectable(GTK_LABEL(distro_release_label), TRUE);
- gtk_widget_set_halign (distro_release_label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (distro_release_label), 0.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (distro_release_label), 0.0, 0.5);
+#endif
gtk_grid_attach(
GTK_GRID(distro_table), distro_release_label,
0, table_count, 1, 1);
@@ -805,7 +817,11 @@ procman_create_sysinfo_view(void)
header = gtk_label_new(markup);
gtk_label_set_selectable(GTK_LABEL(header), TRUE);
g_free(markup);
- gtk_widget_set_halign (header, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (header), 0.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5);
+#endif
gtk_grid_attach(
GTK_GRID(distro_table), header,
0, table_count, 1, 1);
@@ -817,7 +833,11 @@ procman_create_sysinfo_view(void)
header = gtk_label_new(markup);
gtk_label_set_selectable(GTK_LABEL(header), TRUE);
g_free(markup);
- gtk_widget_set_halign (header, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (header), 0.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (header), 0.0, 0.5);
+#endif
gtk_grid_attach(
GTK_GRID(distro_table), header,
0, table_count, 1, 1);
diff --git a/src/util.cpp b/src/util.cpp
index 226dc70..b512744 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);
- gtk_widget_set_halign (label, GTK_ALIGN_START);
+#if GTK_CHECK_VERSION (3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+#else
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+#endif
g_free (title);
g_free (name);