display: Simplify the layout of the display panel

Move the detect displays button to the left.
Remove make default.
Remove the show in panel item because it doesn't work in GNOME 3.
This commit is contained in:
William Jon McCann 2010-10-07 19:44:17 -04:00
parent ab3c66ecdd
commit c06d1fa19a
2 changed files with 21 additions and 161 deletions

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
@ -26,6 +26,7 @@
<child>
<object class="GtkVBox" id="display-panel">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkAlignment" id="align">
@ -35,8 +36,6 @@
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@ -242,7 +241,6 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@ -254,14 +252,13 @@
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="clone_checkbox">
<property name="label" translatable="yes">_Mirror Screens</property>
@ -291,47 +288,19 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="show_notification_icon">
<property name="label" translatable="yes">_Show monitors in panel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="detect_displays_button">
<property name="label" translatable="yes">_Detect monitors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@ -340,20 +309,6 @@
<property name="visible">True</property>
<property name="spacing">6</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="make_default_button">
<property name="label" translatable="yes">Make Default</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="apply_button">
<property name="label">gtk-apply</property>
@ -369,10 +324,25 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="detect_displays_button">
<property name="label" translatable="yes">_Detect monitors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
<property name="secondary">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>

View file

@ -60,7 +60,6 @@ struct App
GtkWidget *resolution_combo;
GtkWidget *refresh_combo;
GtkWidget *rotation_combo;
GtkWidget *panel_checkbox;
GtkWidget *clone_checkbox;
GtkWidget *clone_label;
GtkWidget *show_icon_checkbox;
@ -84,11 +83,6 @@ struct App
} apply_configuration_state;
};
/* Response codes for custom buttons in the main dialog */
enum {
RESPONSE_MAKE_DEFAULT = 1
};
static void rebuild_gui (App *app);
static void on_clone_changed (GtkWidget *box, gpointer data);
static void on_rate_changed (GtkComboBox *box, gpointer data);
@ -692,7 +686,6 @@ rebuild_gui (App *app)
#if 0
g_debug ("sensitive: %d, on: %d", sensitive, app->current_output->on);
#endif
gtk_widget_set_sensitive (app->panel_checkbox, sensitive);
app->ignore_gui_changes = FALSE;
}
@ -2159,19 +2152,6 @@ on_detect_displays (GtkWidget *widget, gpointer data)
}
}
#define SHOW_ICON_KEY "/apps/gnome_settings_daemon/xrandr/show_notification_icon"
static void
on_show_icon_toggled (GtkWidget *widget, gpointer data)
{
GtkToggleButton *tb = GTK_TOGGLE_BUTTON (widget);
App *app = data;
gconf_client_set_bool (app->client, SHOW_ICON_KEY,
gtk_toggle_button_get_active (tb), NULL);
}
static GnomeOutputInfo *
get_nearest_output (GnomeRRConfig *configuration, int x, int y)
{
@ -2326,81 +2306,6 @@ apply_button_clicked_cb (GtkButton *button, gpointer data)
app->apply_button_clicked_timestamp = gtk_get_current_event_time ();
}
static void
success_dialog_for_make_default (App *app)
{
GtkWidget *dialog;
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (app->panel);
dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel),
GTK_DIALOG_MODAL,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
_("The monitor configuration has been saved"));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
_("This configuration will be used the next time someone logs in."));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
static void
error_dialog_for_make_default (App *app, const char *error_text)
{
error_message (app, _("Could not set the default configuration for monitors"), error_text);
}
static void
make_default (App *app)
{
char *command_line;
char *source_filename;
char *dest_filename;
char *dest_basename;
char *std_error;
gint exit_status;
GError *error;
if (!sanitize_and_save_configuration (app))
return;
dest_filename = gconf_client_get_string (app->client, "/apps/gnome_settings_daemon/xrandr/default_configuration_file", NULL);
if (!dest_filename)
return; /* FIXME: present an error? */
dest_basename = g_path_get_basename (dest_filename);
source_filename = gnome_rr_config_get_intended_filename ();
command_line = g_strdup_printf ("pkexec %s/gnome-display-properties-install-systemwide %s %s",
SBINDIR,
source_filename,
dest_basename);
error = NULL;
if (!g_spawn_command_line_sync (command_line, NULL, &std_error, &exit_status, &error))
{
error_dialog_for_make_default (app, error->message);
g_error_free (error);
}
else if (!WIFEXITED (exit_status) || WEXITSTATUS (exit_status) != 0)
{
error_dialog_for_make_default (app, std_error);
}
else
{
success_dialog_for_make_default (app);
}
g_free (std_error);
g_free (dest_filename);
g_free (dest_basename);
g_free (source_filename);
g_free (command_line);
}
static GtkWidget*
_gtk_builder_get_widget (GtkBuilder *builder, const gchar *name)
{
@ -2500,22 +2405,10 @@ run_application (void)
g_signal_connect (_gtk_builder_get_widget (builder, "detect_displays_button"),
"clicked", G_CALLBACK (on_detect_displays), app);
app->show_icon_checkbox = _gtk_builder_get_widget (builder,
"show_notification_icon");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (app->show_icon_checkbox),
gconf_client_get_bool (app->client, SHOW_ICON_KEY, NULL));
g_signal_connect (app->show_icon_checkbox, "toggled", G_CALLBACK (on_show_icon_toggled), app);
app->panel_checkbox = _gtk_builder_get_widget (builder, "panel_checkbox");
make_text_combo (app->resolution_combo, 4);
make_text_combo (app->refresh_combo, 3);
make_text_combo (app->rotation_combo, -1);
g_assert (app->panel_checkbox);
/* Scroll Area */
app->area = (GtkWidget *)foo_scroll_area_new ();
@ -2543,9 +2436,6 @@ run_application (void)
g_signal_connect_swapped (_gtk_builder_get_widget (builder, "apply_button"),
"clicked", G_CALLBACK (apply), app);
g_signal_connect_swapped (_gtk_builder_get_widget (builder,
"make_default_button"),
"clicked", G_CALLBACK (make_default), app);
g_object_weak_ref (G_OBJECT (app->panel), (GWeakNotify) destroy_app, app);