OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 bubble_(NULL), | 104 bubble_(NULL), |
105 factory_(this), | 105 factory_(this), |
106 newly_bookmarked_(newly_bookmarked), | 106 newly_bookmarked_(newly_bookmarked), |
107 apply_edits_(true), | 107 apply_edits_(true), |
108 remove_bookmark_(false) { | 108 remove_bookmark_(false) { |
109 GtkWidget* label = gtk_label_new(l10n_util::GetStringUTF8( | 109 GtkWidget* label = gtk_label_new(l10n_util::GetStringUTF8( |
110 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : | 110 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : |
111 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK).c_str()); | 111 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK).c_str()); |
112 labels_.push_back(label); | 112 labels_.push_back(label); |
113 remove_button_ = theme_service_->BuildChromeLinkButton( | 113 remove_button_ = theme_service_->BuildChromeLinkButton( |
114 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK)); | 114 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_REMOVE_BUTTON)); |
115 GtkWidget* edit_button = gtk_button_new_with_label( | 115 GtkWidget* edit_button = gtk_button_new_with_label( |
116 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_OPTIONS).c_str()); | 116 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_EDIT_BUTTON).c_str()); |
117 GtkWidget* close_button = gtk_button_new_with_label( | 117 GtkWidget* close_button = gtk_button_new_with_label( |
118 l10n_util::GetStringUTF8(IDS_DONE).c_str()); | 118 l10n_util::GetStringUTF8(IDS_DONE).c_str()); |
119 | 119 |
120 // Our content is arranged in 3 rows. |top| contains a left justified | 120 // Our content is arranged in 3 rows. |top| contains a left justified |
121 // message, and a right justified remove link button. |table| is the middle | 121 // message, and a right justified remove link button. |table| is the middle |
122 // portion with the name entry and the folder combo. |bottom| is the final | 122 // portion with the name entry and the folder combo. |bottom| is the final |
123 // row with a spacer, and the edit... and close buttons on the right. | 123 // row with a spacer, and the edit... and close buttons on the right. |
124 GtkWidget* content = gtk_vbox_new(FALSE, 5); | 124 GtkWidget* content = gtk_vbox_new(FALSE, 5); |
125 gtk_container_set_border_width(GTK_CONTAINER(content), | 125 gtk_container_set_border_width(GTK_CONTAINER(content), |
126 ui::kContentAreaBorder); | 126 ui::kContentAreaBorder); |
127 GtkWidget* top = gtk_hbox_new(FALSE, 0); | 127 GtkWidget* top = gtk_hbox_new(FALSE, 0); |
128 | 128 |
129 gtk_misc_set_alignment(GTK_MISC(label), 0, 1); | 129 gtk_misc_set_alignment(GTK_MISC(label), 0, 1); |
130 gtk_box_pack_start(GTK_BOX(top), label, | 130 gtk_box_pack_start(GTK_BOX(top), label, |
131 TRUE, TRUE, 0); | 131 TRUE, TRUE, 0); |
132 gtk_box_pack_start(GTK_BOX(top), remove_button_, | 132 gtk_box_pack_start(GTK_BOX(top), remove_button_, |
133 FALSE, FALSE, 0); | 133 FALSE, FALSE, 0); |
134 | 134 |
135 InitFolderComboModel(); | 135 InitFolderComboModel(); |
136 | 136 |
137 // Create the edit entry for updating the bookmark name / title. | 137 // Create the edit entry for updating the bookmark name / title. |
138 name_entry_ = gtk_entry_new(); | 138 name_entry_ = gtk_entry_new(); |
139 gtk_entry_set_text(GTK_ENTRY(name_entry_), GetTitle().c_str()); | 139 gtk_entry_set_text(GTK_ENTRY(name_entry_), GetTitle().c_str()); |
140 | 140 |
141 // We use a table to allow the labels to line up with each other, along | 141 // We use a table to allow the labels to line up with each other, along |
142 // with the entry and folder combo lining up. | 142 // with the entry and folder combo lining up. |
143 GtkWidget* table = gtk_util::CreateLabeledControlsGroup( | 143 GtkWidget* table = gtk_util::CreateLabeledControlsGroup( |
144 &labels_, | 144 &labels_, |
145 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_TITLE_TEXT).c_str(), | 145 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_NAME_LABEL).c_str(), |
146 name_entry_, | 146 name_entry_, |
147 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT).c_str(), | 147 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_FOLDER_LABEL).c_str(), |
148 folder_combo_, | 148 folder_combo_, |
149 NULL); | 149 NULL); |
150 | 150 |
151 GtkWidget* bottom = gtk_hbox_new(FALSE, 0); | 151 GtkWidget* bottom = gtk_hbox_new(FALSE, 0); |
152 // We want the buttons on the right, so just use an expanding label to fill | 152 // We want the buttons on the right, so just use an expanding label to fill |
153 // all of the extra space on the right. | 153 // all of the extra space on the right. |
154 gtk_box_pack_start(GTK_BOX(bottom), gtk_label_new(""), | 154 gtk_box_pack_start(GTK_BOX(bottom), gtk_label_new(""), |
155 TRUE, TRUE, 0); | 155 TRUE, TRUE, 0); |
156 gtk_box_pack_start(GTK_BOX(bottom), edit_button, | 156 gtk_box_pack_start(GTK_BOX(bottom), edit_button, |
157 FALSE, FALSE, 4); | 157 FALSE, FALSE, 4); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(folder_combo_), | 333 gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(folder_combo_), |
334 IsSeparator, NULL, NULL); | 334 IsSeparator, NULL, NULL); |
335 g_object_unref(store); | 335 g_object_unref(store); |
336 | 336 |
337 GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); | 337 GtkCellRenderer* renderer = gtk_cell_renderer_text_new(); |
338 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(folder_combo_), renderer, TRUE); | 338 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(folder_combo_), renderer, TRUE); |
339 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(folder_combo_), renderer, | 339 gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(folder_combo_), renderer, |
340 "text", COLUMN_NAME, | 340 "text", COLUMN_NAME, |
341 NULL); | 341 NULL); |
342 } | 342 } |
OLD | NEW |