diff options
author | infirit <[email protected]> | 2015-07-06 20:38:55 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2015-07-07 01:19:55 +0200 |
commit | e85b0f646c3e5713ab18a59f223edf87199afb0c (patch) | |
tree | cc84ca87fd166882ad4f431e7fe760b8721ee20b | |
parent | 3aaa999053462f255aca40300042c209b47aca65 (diff) | |
download | mate-sensors-applet-e85b0f646c3e5713ab18a59f223edf87199afb0c.tar.bz2 mate-sensors-applet-e85b0f646c3e5713ab18a59f223edf87199afb0c.tar.xz |
Use content_area variable
Instead of calling gtk_dialog_get_content_area multiple times.
Taken from gnome-sensors-applet,
commit: 840aa67ae36ae36b7b8c74b4cd7511f96328982f
From: Lucian Langa <[email protected]>
-rw-r--r-- | sensors-applet/prefs-dialog.c | 13 | ||||
-rw-r--r-- | sensors-applet/sensor-config-dialog.c | 5 |
2 files changed, 13 insertions, 5 deletions
diff --git a/sensors-applet/prefs-dialog.c b/sensors-applet/prefs-dialog.c index 002a668..ab2278c 100644 --- a/sensors-applet/prefs-dialog.c +++ b/sensors-applet/prefs-dialog.c @@ -389,6 +389,7 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { gchar *header_text; PrefsDialog *prefs_dialog; DisplayMode display_mode; + GtkWidget *content_area; g_assert(sensors_applet->prefs_dialog == NULL); @@ -420,9 +421,10 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { "default-height", 350, NULL); - gtk_box_set_homogeneous(GTK_BOX(gtk_dialog_get_content_area (prefs_dialog->dialog)), FALSE); + content_area = gtk_dialog_get_content_area (prefs_dialog->dialog); + gtk_box_set_homogeneous(GTK_BOX(content_area), FALSE); - gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area (prefs_dialog->dialog)), 5); + gtk_box_set_spacing(GTK_BOX(content_area), 5); g_signal_connect(prefs_dialog->dialog, @@ -441,8 +443,10 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { we haven't been able to access any sensors */ if (sensors_applet->sensors == NULL) { GtkWidget *label; + GtkWidget *content_area; label = gtk_label_new(_("No sensors found!")); - gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area (prefs_dialog->dialog)), label, TRUE, TRUE, 0); + content_area = gtk_dialog_get_content_area (prefs_dialog->dialog); + gtk_box_pack_start (GTK_BOX(content_area), label, FALSE, FALSE, 0); return; } @@ -990,7 +994,8 @@ void prefs_dialog_open(SensorsApplet *sensors_applet) { gtk_label_new(_("Sensors"))); /* pack notebook into prefs_dialog */ - gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area (prefs_dialog->dialog)), + content_area = gtk_dialog_get_content_area (prefs_dialog->dialog); + gtk_box_pack_start (GTK_BOX(content_area), GTK_WIDGET(prefs_dialog->notebook), TRUE, TRUE, 0); diff --git a/sensors-applet/sensor-config-dialog.c b/sensors-applet/sensor-config-dialog.c index cc09305..bb76da6 100644 --- a/sensors-applet/sensor-config-dialog.c +++ b/sensors-applet/sensor-config-dialog.c @@ -323,6 +323,7 @@ static void sensor_config_dialog_graph_color_set(GtkColorButton *color_button, GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; + GtkWidget *content_area; GdkColor color; gchar *color_string; @@ -352,6 +353,7 @@ static void sensor_config_dialog_graph_color_set(GtkColorButton *color_button, void sensor_config_dialog_create(SensorsApplet *sensors_applet) { GtkTreeModel *model; GtkTreeIter iter; + GtkWidget *content_area; SensorConfigDialog *config_dialog; @@ -912,7 +914,8 @@ void sensor_config_dialog_create(SensorsApplet *sensors_applet) { 2, 3, 14, 15); - gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area (GTK_DIALOG(config_dialog->dialog))), GTK_WIDGET(config_dialog->table), TRUE, TRUE, 0); + content_area = gtk_dialog_get_content_area (GTK_DIALOG(config_dialog->dialog)); + gtk_box_pack_start(GTK_BOX(content_area), GTK_WIDGET(config_dialog->table), FALSE, FALSE, 0); gtk_widget_show_all(config_dialog->dialog); } |