summaryrefslogtreecommitdiff
path: root/multiload/properties.c
diff options
context:
space:
mode:
Diffstat (limited to 'multiload/properties.c')
-rw-r--r--multiload/properties.c85
1 files changed, 18 insertions, 67 deletions
diff --git a/multiload/properties.c b/multiload/properties.c
index b00635d8..47fb235e 100644
--- a/multiload/properties.c
+++ b/multiload/properties.c
@@ -33,11 +33,6 @@
#define HIG_IDENTATION " "
#define NEVER_SENSITIVE "never_sensitive"
-#if GTK_CHECK_VERSION (3, 0, 0)
-#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y)
-#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y)
-#endif
-
/* set sensitive and setup NEVER_SENSITIVE appropriately */
static void
hard_set_sensitive (GtkWidget *w, gboolean sensitivity)
@@ -203,10 +198,8 @@ add_page(GtkWidget *notebook, gchar *label)
GtkWidget *page;
GtkWidget *page_label;
- page = gtk_hbox_new(TRUE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
+ page = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous (GTK_BOX (page), TRUE);
-#endif
page_label = gtk_label_new(label);
gtk_container_set_border_width(GTK_CONTAINER(page), 6);
@@ -217,21 +210,11 @@ add_page(GtkWidget *notebook, gchar *label)
/* save the selected color to gsettings and apply it on the applet */
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
color_picker_set_cb(GtkColorChooser *color_picker, gchar *key)
-#else
-color_picker_set_cb(GtkColorButton *color_picker, gchar *key)
-#endif
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gchar *color_string;
guint8 prop_type;
GdkRGBA color;
-#else
- gchar color_string[8];
- guint8 prop_type;
- GdkColor color;
-#endif
MultiloadApplet *ma;
ma = g_object_get_data (G_OBJECT (color_picker), "MultiloadApplet");
@@ -251,7 +234,6 @@ color_picker_set_cb(GtkColorButton *color_picker, gchar *key)
else
g_assert_not_reached();
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_color_chooser_get_rgba(color_picker, &color);
color_string = gdk_rgba_to_string (&color);
@@ -259,21 +241,7 @@ color_picker_set_cb(GtkColorButton *color_picker, gchar *key)
gdk_rgba_parse(&(ma->graphs[prop_type]->colors[g_ascii_digit_value(key[strlen(key) - 1]) ]),
color_string);
-#else
- gtk_color_button_get_color(color_picker, &color);
-
- snprintf(color_string, 8, "#%02X%02X%02X",
- color.red / 256, color.green / 256, color.blue / 256);
- g_settings_set_string(ma->settings, key, color_string);
- gdk_color_parse(color_string,
- &(ma->graphs[prop_type]->colors[g_ascii_digit_value(key[strlen(key) - 1]) ]) );
-#endif
-
-#if !GTK_CHECK_VERSION (3, 0, 0)
- ma->graphs[prop_type]->colors_allocated = FALSE;
-#endif
-
return;
}
@@ -284,29 +252,16 @@ add_color_selector(GtkWidget *page, gchar *name, gchar *key, MultiloadApplet *ma
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *color_picker;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color;
-#else
- GdkColor color;
-#endif
gchar *color_string;
color_string = g_settings_get_string (ma->settings, key);
if (!color_string)
color_string = g_strdup ("#000000");
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_rgba_parse (&color, color_string);
-#else
- color.red = (g_ascii_xdigit_value(color_string[1]) * 16
- + g_ascii_xdigit_value(color_string[2])) * 256;
- color.green = (g_ascii_xdigit_value(color_string[3]) * 16
- + g_ascii_xdigit_value(color_string[4])) * 256;
- color.blue = (g_ascii_xdigit_value(color_string[5]) * 16
- + g_ascii_xdigit_value(color_string[6])) * 256;
-#endif
g_free (color_string);
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
label = gtk_label_new_with_mnemonic(name);
color_picker = gtk_color_button_new();
gtk_label_set_mnemonic_widget (GTK_LABEL (label), color_picker);
@@ -318,11 +273,7 @@ add_color_selector(GtkWidget *page, gchar *name, gchar *key, MultiloadApplet *ma
g_object_set_data (G_OBJECT (color_picker), "MultiloadApplet", ma);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(color_picker), &color);
-#else
- gtk_color_button_set_color(GTK_COLOR_BUTTON(color_picker), &color);
-#endif
g_signal_connect(G_OBJECT(color_picker), "color_set", G_CALLBACK(color_picker_set_cb), key);
@@ -352,18 +303,18 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gchar *label_text;
gchar *title;
- vbox = gtk_vbox_new (FALSE, 0);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_widget_show (vbox);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), vbox,
TRUE, TRUE, 0);
- categories_vbox = gtk_vbox_new (FALSE, 18);
+ categories_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_box_pack_start (GTK_BOX (vbox), categories_vbox, TRUE, TRUE, 0);
gtk_widget_show (categories_vbox);
- category_vbox = gtk_vbox_new (FALSE, 6);
+ category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0);
gtk_widget_show (category_vbox);
@@ -379,7 +330,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_box_pack_start (GTK_BOX (category_vbox), label, FALSE, FALSE, 0);
g_free (title);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@@ -388,11 +339,11 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0);
gtk_widget_show (indent);
- control_vbox = gtk_vbox_new (FALSE, 6);
+ control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0);
gtk_widget_show (control_vbox);
- control_hbox = gtk_hbox_new (FALSE, 12);
+ control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0);
gtk_widget_show (control_hbox);
@@ -472,7 +423,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
G_CALLBACK (property_toggled_cb), "view-diskload");
gtk_box_pack_start (GTK_BOX (control_hbox), check_box, FALSE, FALSE, 0);
- category_vbox = gtk_vbox_new (FALSE, 6);
+ category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0);
gtk_widget_show (category_vbox);
@@ -489,7 +440,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_widget_show (label);
g_free (title);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@@ -498,11 +449,11 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0);
gtk_widget_show (indent);
- control_vbox = gtk_vbox_new (FALSE, 6);
+ control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0);
gtk_widget_show (control_vbox);
- control_hbox = gtk_hbox_new (FALSE, 12);
+ control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0);
gtk_widget_show (control_hbox);
@@ -523,7 +474,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_size_group_add_widget (label_size, label);
gtk_box_pack_start (GTK_BOX (control_hbox), label, FALSE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (control_hbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@@ -555,7 +506,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
#endif
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- control_hbox = gtk_hbox_new (FALSE, 12);
+ control_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (control_vbox), control_hbox, TRUE, TRUE, 0);
gtk_widget_show (control_hbox);
@@ -568,7 +519,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_size_group_add_widget (label_size, label);
gtk_box_pack_start (GTK_BOX (control_hbox), label, FALSE, FALSE, 0);
- hbox = gtk_hbox_new (FALSE, 6);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_box_pack_start (GTK_BOX (control_hbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@@ -600,7 +551,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
g_free(label_text);
- category_vbox = gtk_vbox_new (FALSE, 6);
+ category_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (categories_vbox), category_vbox, TRUE, TRUE, 0);
gtk_widget_show (category_vbox);
@@ -617,7 +568,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_widget_show (label);
g_free (title);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
@@ -626,7 +577,7 @@ fill_properties(GtkWidget *dialog, MultiloadApplet *ma)
gtk_box_pack_start (GTK_BOX (hbox), indent, FALSE, FALSE, 0);
gtk_widget_show (indent);
- control_vbox = gtk_vbox_new (FALSE, 6);
+ control_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (hbox), control_vbox, TRUE, TRUE, 0);
gtk_widget_show (control_vbox);