[Xfce4-commits] <xfce4-settings:bluesabre/display-settings> Fix small memleak and don't recolor identity-popup when there's only one display
Simon Steinbeiss
noreply at xfce.org
Mon Oct 8 16:26:01 CEST 2012
Updating branch refs/heads/bluesabre/display-settings
to fe1b2df19480800745892387a0a06f4001230ffe (commit)
from f719c097b50cadac6bace060df50fb2c71fb8de3 (commit)
commit fe1b2df19480800745892387a0a06f4001230ffe
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Mon Oct 8 16:24:48 2012 +0200
Fix small memleak and don't recolor identity-popup when there's only one display
dialogs/display-settings/main.c | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index e8c0e52..b7f3e3e 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1061,7 +1061,7 @@ display_setting_identity_display (gint display_id,
GObject *display_name, *display_details;
- gchar *name, *color_hex;
+ gchar *name, *color_hex, *name_label, *details_label;
gint active_output;
XfceRRMode *current_mode;
@@ -1108,13 +1108,14 @@ display_setting_identity_display (gint display_id,
xfce_randr->output_info[display_id]->name);
color_hex = "#FFFFFF";
if ((has_selection)) color_hex = "#D20000";
-
- gtk_label_set_markup (GTK_LABEL(display_name),
- g_markup_printf_escaped("<span foreground='%s'><big><b>%s %s</b></big></span>", color_hex, _("Display:"), name) );
- gtk_label_set_markup (GTK_LABEL(display_details),
- g_markup_printf_escaped("<span foreground='%s'>%s %i x %i</span>", color_hex, _("Resolution:"), screen_width, screen_height) );
-
+ name_label = g_markup_printf_escaped("<span foreground='%s'><big><b>%s %s</b></big></span>", color_hex, _("Display:"), name);
+ gtk_label_set_markup (GTK_LABEL(display_name), name_label);
+ g_free (name_label);
+
+ details_label = g_markup_printf_escaped("<span foreground='%s'>%s %i x %i</span>", color_hex, _("Resolution:"), screen_width, screen_height);
+ gtk_label_set_markup (GTK_LABEL(display_details), details_label);
+ g_free (details_label);
gtk_window_get_size(GTK_WINDOW(popup), &window_width, &window_height);
@@ -1390,26 +1391,28 @@ display_settings_treeview_selection_changed (GtkTreeSelection *selection,
gtk_widget_set_sensitive( GTK_WIDGET(display_combo), FALSE );
}
+ if (display_settings_get_n_active_outputs() > 1) {
switch (active_id) {
case 0:
- gtk_widget_destroy(display_popups.display1);
+ if (GTK_IS_WIDGET(display_popups.display1)) gtk_widget_destroy(display_popups.display1);
display_popups.display1 = display_setting_identity_display(active_id, error, has_selection);
break;
case 1:
- gtk_widget_destroy(display_popups.display2);
+ if (GTK_IS_WIDGET(display_popups.display2)) gtk_widget_destroy(display_popups.display2);
display_popups.display2 = display_setting_identity_display(active_id, error, has_selection);
break;
case 2:
- gtk_widget_destroy(display_popups.display3);
+ if (GTK_IS_WIDGET(display_popups.display3)) gtk_widget_destroy(display_popups.display3);
display_popups.display3 = display_setting_identity_display(active_id, error, has_selection);
break;
case 3:
- gtk_widget_destroy(display_popups.display4);
+ if (GTK_IS_WIDGET(display_popups.display4)) gtk_widget_destroy(display_popups.display4);
display_popups.display4 = display_setting_identity_display(active_id, error, has_selection);
break;
default:
break;
}
+ }
}
}
More information about the Xfce4-commits
mailing list