gnome-control-center r9168 - trunk/capplets/display
- From: federico svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-control-center r9168 - trunk/capplets/display
- Date: Mon, 15 Dec 2008 18:59:58 +0000 (UTC)
Author: federico
Date: Mon Dec 15 18:59:57 2008
New Revision: 9168
URL: http://svn.gnome.org/viewvc/gnome-control-center?rev=9168&view=rev
Log:
Show which monitor is being edited in the 'Monitor' label
2008-12-15 Federico Mena Quintero <federico novell com>
* display-capplet.glade: Put the "Monitor" label inside an event
box, so we can change the background color of the event box. Give
names to both widgets: current_monitor_label,
current_monitor_event_box.
* xrandr-capplet.c (rebuild_gui): When a monitor is selected,
update the "Monitor" label to include the monitor's name and color
so the user will know which monitor he is editing.
(rebuild_current_monitor_label): New function.
(struct App): New fields current_monitor_label,
current_monitor_event_box.
Signed-off-by: Federico Mena Quintero <federico novell com>
Modified:
trunk/capplets/display/ChangeLog
trunk/capplets/display/display-capplet.glade
trunk/capplets/display/xrandr-capplet.c
Modified: trunk/capplets/display/display-capplet.glade
==============================================================================
--- trunk/capplets/display/display-capplet.glade (original)
+++ trunk/capplets/display/display-capplet.glade Mon Dec 15 18:59:57 2008
@@ -183,22 +183,30 @@
</child>
<child>
- <widget class="GtkLabel" id="label7">
+ <widget class="GtkEventBox" id="current_monitor_event_box">
<property name="visible">True</property>
- <property name="label" translatable="yes"><b>Monitor</b></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
+ <property name="visible_window">True</property>
+ <property name="above_child">False</property>
+
+ <child>
+ <widget class="GtkLabel" id="current_monitor_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Monitor</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: trunk/capplets/display/xrandr-capplet.c
==============================================================================
--- trunk/capplets/display/xrandr-capplet.c (original)
+++ trunk/capplets/display/xrandr-capplet.c Mon Dec 15 18:59:57 2008
@@ -47,6 +47,8 @@
GnomeOutputInfo *current_output;
GtkWidget *dialog;
+ GtkWidget *current_monitor_event_box;
+ GtkWidget *current_monitor_label;
GtkListStore *resolution_store;
GtkWidget *resolution_combo;
GtkWidget *refresh_combo;
@@ -447,6 +449,39 @@
#endif
static void
+rebuild_current_monitor_label (App *app)
+{
+ char *str;
+ gboolean free_str;
+ GdkColor color;
+ gboolean use_color;
+
+ if (app->current_output)
+ {
+ str = g_strdup_printf (_("<b>Monitor: %s</b>"), app->current_output->display_name);
+ free_str = TRUE;
+ gnome_rr_labeler_get_color_for_output (app->labeler, app->current_output, &color);
+ use_color = TRUE;
+ }
+ else
+ {
+ str = _("<b>Monitor</b>");
+ free_str = FALSE;
+ use_color = FALSE;
+ }
+
+ gtk_label_set_markup (GTK_LABEL (app->current_monitor_label), str);
+
+ if (free_str)
+ g_free (str);
+
+ if (use_color)
+ gtk_widget_modify_bg (app->current_monitor_event_box, app->current_monitor_event_box->state, &color);
+
+ gtk_event_box_set_visible_window (GTK_EVENT_BOX (app->current_monitor_event_box), use_color);
+}
+
+static void
rebuild_resolution_combo (App *app)
{
int i;
@@ -520,6 +555,7 @@
g_debug ("rebuild gui, is on: %d", app->current_output->on);
#endif
+ rebuild_current_monitor_label (app);
rebuild_resolution_combo (app);
rebuild_rate_combo (app);
rebuild_rotation_combo (app);
@@ -1722,6 +1758,9 @@
gtk_window_set_icon_name (GTK_WINDOW (app->dialog),
"gnome-display-properties");
+ app->current_monitor_event_box = glade_xml_get_widget (xml, "current_monitor_event_box");
+ app->current_monitor_label = glade_xml_get_widget (xml, "current_monitor_label");
+
app->resolution_combo = glade_xml_get_widget (xml, "resolution_combo");
g_signal_connect (app->resolution_combo, "changed",
G_CALLBACK (on_resolution_changed), app);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]