| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 anchor_(anchor), | 88 anchor_(anchor), |
| 89 content_(NULL), | 89 content_(NULL), |
| 90 name_entry_(NULL), | 90 name_entry_(NULL), |
| 91 folder_combo_(NULL), | 91 folder_combo_(NULL), |
| 92 bubble_(NULL), | 92 bubble_(NULL), |
| 93 factory_(this), | 93 factory_(this), |
| 94 newly_bookmarked_(newly_bookmarked), | 94 newly_bookmarked_(newly_bookmarked), |
| 95 apply_edits_(true), | 95 apply_edits_(true), |
| 96 remove_bookmark_(false) { | 96 remove_bookmark_(false) { |
| 97 GtkWidget* label = gtk_label_new(l10n_util::GetStringUTF8( | 97 GtkWidget* label = gtk_label_new(l10n_util::GetStringUTF8( |
| 98 newly_bookmarked_ ? IDS_BOOMARK_BUBBLE_PAGE_BOOKMARKED : | 98 newly_bookmarked_ ? IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARKED : |
| 99 IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK).c_str()); | 99 IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK).c_str()); |
| 100 labels_.push_back(label); | 100 labels_.push_back(label); |
| 101 remove_button_ = theme_service_->BuildChromeLinkButton( | 101 remove_button_ = theme_service_->BuildChromeLinkButton( |
| 102 l10n_util::GetStringUTF8(IDS_BOOMARK_BUBBLE_REMOVE_BOOKMARK)); | 102 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_REMOVE_BOOKMARK)); |
| 103 GtkWidget* edit_button = gtk_button_new_with_label( | 103 GtkWidget* edit_button = gtk_button_new_with_label( |
| 104 l10n_util::GetStringUTF8(IDS_BOOMARK_BUBBLE_OPTIONS).c_str()); | 104 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_OPTIONS).c_str()); |
| 105 GtkWidget* close_button = gtk_button_new_with_label( | 105 GtkWidget* close_button = gtk_button_new_with_label( |
| 106 l10n_util::GetStringUTF8(IDS_DONE).c_str()); | 106 l10n_util::GetStringUTF8(IDS_DONE).c_str()); |
| 107 | 107 |
| 108 // Our content is arranged in 3 rows. |top| contains a left justified | 108 // Our content is arranged in 3 rows. |top| contains a left justified |
| 109 // message, and a right justified remove link button. |table| is the middle | 109 // message, and a right justified remove link button. |table| is the middle |
| 110 // portion with the name entry and the folder combo. |bottom| is the final | 110 // portion with the name entry and the folder combo. |bottom| is the final |
| 111 // row with a spacer, and the edit... and close buttons on the right. | 111 // row with a spacer, and the edit... and close buttons on the right. |
| 112 GtkWidget* content = gtk_vbox_new(FALSE, 5); | 112 GtkWidget* content = gtk_vbox_new(FALSE, 5); |
| 113 gtk_container_set_border_width(GTK_CONTAINER(content), kContentBorder); | 113 gtk_container_set_border_width(GTK_CONTAINER(content), kContentBorder); |
| 114 GtkWidget* top = gtk_hbox_new(FALSE, 0); | 114 GtkWidget* top = gtk_hbox_new(FALSE, 0); |
| 115 | 115 |
| 116 gtk_misc_set_alignment(GTK_MISC(label), 0, 1); | 116 gtk_misc_set_alignment(GTK_MISC(label), 0, 1); |
| 117 gtk_box_pack_start(GTK_BOX(top), label, | 117 gtk_box_pack_start(GTK_BOX(top), label, |
| 118 TRUE, TRUE, 0); | 118 TRUE, TRUE, 0); |
| 119 gtk_box_pack_start(GTK_BOX(top), remove_button_, | 119 gtk_box_pack_start(GTK_BOX(top), remove_button_, |
| 120 FALSE, FALSE, 0); | 120 FALSE, FALSE, 0); |
| 121 | 121 |
| 122 folder_combo_ = gtk_combo_box_new_text(); | 122 folder_combo_ = gtk_combo_box_new_text(); |
| 123 InitFolderComboModel(); | 123 InitFolderComboModel(); |
| 124 | 124 |
| 125 // Create the edit entry for updating the bookmark name / title. | 125 // Create the edit entry for updating the bookmark name / title. |
| 126 name_entry_ = gtk_entry_new(); | 126 name_entry_ = gtk_entry_new(); |
| 127 gtk_entry_set_text(GTK_ENTRY(name_entry_), GetTitle().c_str()); | 127 gtk_entry_set_text(GTK_ENTRY(name_entry_), GetTitle().c_str()); |
| 128 | 128 |
| 129 // We use a table to allow the labels to line up with each other, along | 129 // We use a table to allow the labels to line up with each other, along |
| 130 // with the entry and folder combo lining up. | 130 // with the entry and folder combo lining up. |
| 131 GtkWidget* table = gtk_util::CreateLabeledControlsGroup( | 131 GtkWidget* table = gtk_util::CreateLabeledControlsGroup( |
| 132 &labels_, | 132 &labels_, |
| 133 l10n_util::GetStringUTF8(IDS_BOOMARK_BUBBLE_TITLE_TEXT).c_str(), | 133 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_TITLE_TEXT).c_str(), |
| 134 name_entry_, | 134 name_entry_, |
| 135 l10n_util::GetStringUTF8(IDS_BOOMARK_BUBBLE_FOLDER_TEXT).c_str(), | 135 l10n_util::GetStringUTF8(IDS_BOOKMARK_BUBBLE_FOLDER_TEXT).c_str(), |
| 136 folder_combo_, | 136 folder_combo_, |
| 137 NULL); | 137 NULL); |
| 138 | 138 |
| 139 GtkWidget* bottom = gtk_hbox_new(FALSE, 0); | 139 GtkWidget* bottom = gtk_hbox_new(FALSE, 0); |
| 140 // We want the buttons on the right, so just use an expanding label to fill | 140 // We want the buttons on the right, so just use an expanding label to fill |
| 141 // all of the extra space on the right. | 141 // all of the extra space on the right. |
| 142 gtk_box_pack_start(GTK_BOX(bottom), gtk_label_new(""), | 142 gtk_box_pack_start(GTK_BOX(bottom), gtk_label_new(""), |
| 143 TRUE, TRUE, 0); | 143 TRUE, TRUE, 0); |
| 144 gtk_box_pack_start(GTK_BOX(bottom), edit_button, | 144 gtk_box_pack_start(GTK_BOX(bottom), edit_button, |
| 145 FALSE, FALSE, 4); | 145 FALSE, FALSE, 4); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // We always have nodes + 1 entries in the combo. The last entry will be | 341 // We always have nodes + 1 entries in the combo. The last entry will be |
| 342 // the 'Select another folder...' entry that opens the bookmark editor. | 342 // the 'Select another folder...' entry that opens the bookmark editor. |
| 343 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { | 343 for (int i = 0; i < folder_combo_model_->GetItemCount(); ++i) { |
| 344 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), | 344 gtk_combo_box_append_text(GTK_COMBO_BOX(folder_combo_), |
| 345 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); | 345 UTF16ToUTF8(folder_combo_model_->GetItemAt(i)).c_str()); |
| 346 } | 346 } |
| 347 | 347 |
| 348 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), | 348 gtk_combo_box_set_active(GTK_COMBO_BOX(folder_combo_), |
| 349 folder_combo_model_->node_parent_index()); | 349 folder_combo_model_->node_parent_index()); |
| 350 } | 350 } |
| OLD | NEW |