summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/options
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-25 10:04:16 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-25 10:04:16 +0000
commit3b3f5e8b9f55d2a1b906eb8a4becac2a98adfd8e (patch)
treef88c8803aa465aabde5ea582bdeec12cb1a5c0c0 /chrome/browser/gtk/options
parent3b553cca52ab5e58ebb7629819150c68ec439aa0 (diff)
downloadchromium_src-3b3f5e8b9f55d2a1b906eb8a4becac2a98adfd8e.zip
chromium_src-3b3f5e8b9f55d2a1b906eb8a4becac2a98adfd8e.tar.gz
chromium_src-3b3f5e8b9f55d2a1b906eb8a4becac2a98adfd8e.tar.bz2
linux: pretty up cookie exceptions window
Move the buttons to the right to improve the balance of the window. Review URL: http://codereview.chromium.org/652230 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/options')
-rw-r--r--chrome/browser/gtk/options/content_exceptions_window_gtk.cc92
-rw-r--r--chrome/browser/gtk/options/content_exceptions_window_gtk.h15
2 files changed, 54 insertions, 53 deletions
diff --git a/chrome/browser/gtk/options/content_exceptions_window_gtk.cc b/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
index 605b831..3ded33d 100644
--- a/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
+++ b/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
@@ -17,29 +17,17 @@ namespace {
// Singletons for each possible exception window.
ContentExceptionsWindowGtk* instances[CONTENT_SETTINGS_NUM_TYPES] = { NULL };
-// Response ids for our custom buttons.
-enum {
- RESPONSE_ADD = 1,
- RESPONSE_EDIT,
- RESPONSE_REMOVE,
- RESPONSE_REMOVE_ALL
-};
-
GtkWidget* BuildDialogButton(GtkWidget* dialog, int ids_id,
- const gchar* stock_id, gint response_id) {
- GtkWidget* widget = gtk_util::AddButtonToDialog(
- dialog,
+ const gchar* stock_id) {
+ GtkWidget* button = gtk_button_new_with_label(
gtk_util::ConvertAcceleratorsFromWindowsStyle(
- l10n_util::GetStringUTF8(ids_id)).c_str(),
- stock_id,
- response_id);
- gtk_button_set_use_underline(GTK_BUTTON(widget), TRUE);
- gtk_button_box_set_child_secondary(
- GTK_BUTTON_BOX(GTK_DIALOG(dialog)->action_area),
- widget,
- TRUE);
-
- return widget;
+ l10n_util::GetStringUTF8(ids_id)).c_str());
+ gtk_button_set_image(GTK_BUTTON(button),
+ gtk_image_new_from_stock(stock_id,
+ GTK_ICON_SIZE_BUTTON));
+ gtk_button_set_use_underline(GTK_BUTTON(button), TRUE);
+
+ return button;
}
} // namespace
@@ -108,11 +96,15 @@ ContentExceptionsWindowGtk::ContentExceptionsWindowGtk(
GTK_STOCK_CLOSE,
GTK_RESPONSE_CLOSE,
NULL);
+ gtk_window_set_default_size(GTK_WINDOW(dialog_), 500, -1);
// Allow browser windows to go in front of the options dialog in metacity.
gtk_window_set_type_hint(GTK_WINDOW(dialog_), GDK_WINDOW_TYPE_HINT_NORMAL);
gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox),
gtk_util::kContentAreaSpacing);
+ GtkWidget* hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing);
+ gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog_)->vbox), hbox);
+
// Create a scrolled window to wrap the treeview widget in order to have a
// frame.
GtkWidget* scrolled = gtk_scrolled_window_new(NULL, NULL);
@@ -120,26 +112,44 @@ ContentExceptionsWindowGtk::ContentExceptionsWindowGtk(
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog_)->vbox), scrolled);
-
- // Add the main tree view to the scrolled window.
gtk_container_add(GTK_CONTAINER(scrolled), treeview_);
+ gtk_box_pack_start(GTK_BOX(hbox), scrolled, TRUE, TRUE, 0);
+
+ GtkWidget* button_box = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
+
+ GtkWidget* add_button = BuildDialogButton(dialog_, IDS_EXCEPTIONS_ADD_BUTTON,
+ GTK_STOCK_ADD);
+ g_signal_connect(add_button, "clicked",
+ G_CALLBACK(&ContentExceptionsWindowGtk::AddThunk), this);
+ gtk_box_pack_start(GTK_BOX(button_box), add_button, FALSE, FALSE, 0);
- BuildDialogButton(dialog_, IDS_EXCEPTIONS_ADD_BUTTON,
- GTK_STOCK_ADD, RESPONSE_ADD);
edit_button_ = BuildDialogButton(dialog_, IDS_EXCEPTIONS_EDIT_BUTTON,
- GTK_STOCK_EDIT, RESPONSE_EDIT);
+ GTK_STOCK_EDIT);
+ g_signal_connect(edit_button_, "clicked",
+ G_CALLBACK(&ContentExceptionsWindowGtk::EditThunk), this);
+ gtk_box_pack_start(GTK_BOX(button_box), edit_button_, FALSE, FALSE, 0);
+
remove_button_ = BuildDialogButton(dialog_, IDS_EXCEPTIONS_REMOVE_BUTTON,
- GTK_STOCK_REMOVE, RESPONSE_REMOVE);
- remove_all_button_ = BuildDialogButton(
- dialog_, IDS_EXCEPTIONS_REMOVEALL_BUTTON,
- GTK_STOCK_CLEAR, RESPONSE_REMOVE_ALL);
+ GTK_STOCK_REMOVE);
+ g_signal_connect(remove_button_, "clicked",
+ G_CALLBACK(&ContentExceptionsWindowGtk::RemoveThunk), this);
+ gtk_box_pack_start(GTK_BOX(button_box), remove_button_, FALSE, FALSE, 0);
+
+ remove_all_button_ = BuildDialogButton(dialog_,
+ IDS_EXCEPTIONS_REMOVEALL_BUTTON,
+ GTK_STOCK_CLEAR);
+ g_signal_connect(remove_all_button_, "clicked",
+ G_CALLBACK(&ContentExceptionsWindowGtk::RemoveAllThunk),
+ this);
+ gtk_box_pack_start(GTK_BOX(button_box), remove_all_button_, FALSE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(hbox), button_box, FALSE, FALSE, 0);
UpdateButtonState();
gtk_widget_show_all(dialog_);
- g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), this);
+ g_signal_connect(dialog_, "response", G_CALLBACK(gtk_widget_destroy), NULL);
g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this);
}
@@ -237,24 +247,6 @@ std::string ContentExceptionsWindowGtk::GetWindowTitle() const {
}
// static
-void ContentExceptionsWindowGtk::OnResponse(
- GtkDialog* dialog,
- int response_id,
- ContentExceptionsWindowGtk* window) {
- if (response_id == RESPONSE_ADD) {
- window->Add();
- } else if (response_id == RESPONSE_EDIT) {
- window->Edit();
- } else if (response_id == RESPONSE_REMOVE) {
- window->Remove();
- } else if (response_id == RESPONSE_REMOVE_ALL) {
- window->RemoveAll();
- } else {
- gtk_widget_destroy(window->dialog_);
- }
-}
-
-// static
void ContentExceptionsWindowGtk::OnWindowDestroy(
GtkWidget* widget,
ContentExceptionsWindowGtk* window) {
diff --git a/chrome/browser/gtk/options/content_exceptions_window_gtk.h b/chrome/browser/gtk/options/content_exceptions_window_gtk.h
index fece1a3..c6073c3 100644
--- a/chrome/browser/gtk/options/content_exceptions_window_gtk.h
+++ b/chrome/browser/gtk/options/content_exceptions_window_gtk.h
@@ -54,9 +54,21 @@ class ContentExceptionsWindowGtk : public gtk_tree::TableAdapter::Delegate,
void UpdateButtonState();
// Callbacks for the buttons.
+ static void AddThunk(GtkButton* unused, gpointer self) {
+ reinterpret_cast<ContentExceptionsWindowGtk*>(self)->Add();
+ }
void Add();
+ static void EditThunk(GtkButton* unused, gpointer self) {
+ reinterpret_cast<ContentExceptionsWindowGtk*>(self)->Edit();
+ }
void Edit();
+ static void RemoveThunk(GtkButton* unused, gpointer self) {
+ reinterpret_cast<ContentExceptionsWindowGtk*>(self)->Remove();
+ }
void Remove();
+ static void RemoveAllThunk(GtkButton* unused, gpointer self) {
+ reinterpret_cast<ContentExceptionsWindowGtk*>(self)->RemoveAll();
+ }
void RemoveAll();
// Returns the title of the window (changes based on what ContentSettingsType
@@ -64,9 +76,6 @@ class ContentExceptionsWindowGtk : public gtk_tree::TableAdapter::Delegate,
std::string GetWindowTitle() const;
// GTK Callbacks
- static void OnResponse(GtkDialog* dialog,
- int response_id,
- ContentExceptionsWindowGtk* window);
static void OnWindowDestroy(GtkWidget* widget,
ContentExceptionsWindowGtk* window);
static void OnSelectionChanged(GtkTreeSelection* selection,