OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/options/content_page_gtk.h" | 5 #include "chrome/browser/gtk/options/content_page_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/gtk_util.h" | 9 #include "app/gtk_util.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // Background color for the status label when it's showing an error. | 39 // Background color for the status label when it's showing an error. |
40 static const GdkColor kSyncLabelErrorBgColor = GDK_COLOR_RGB(0xff, 0x9a, 0x9a); | 40 static const GdkColor kSyncLabelErrorBgColor = GDK_COLOR_RGB(0xff, 0x9a, 0x9a); |
41 | 41 |
42 // Helper for WrapLabelAtAllocationHack. | 42 // Helper for WrapLabelAtAllocationHack. |
43 void OnLabelAllocate(GtkWidget* label, GtkAllocation* allocation) { | 43 void OnLabelAllocate(GtkWidget* label, GtkAllocation* allocation) { |
44 gtk_widget_set_size_request(label, allocation->width, -1); | 44 gtk_widget_set_size_request(label, allocation->width, -1); |
45 | 45 |
46 // Disconnect ourselves. Repeatedly resizing based on allocation causes | 46 // Disconnect ourselves. Repeatedly resizing based on allocation causes |
47 // the dialog to become unshrinkable. | 47 // the dialog to become unshrinkable. |
48 g_signal_handlers_disconnect_by_func(label, (void*)OnLabelAllocate, | 48 g_signal_handlers_disconnect_by_func( |
49 NULL); | 49 label, reinterpret_cast<gpointer>(OnLabelAllocate), NULL); |
50 } | 50 } |
51 | 51 |
52 // Set the label to use a request size equal to its initial allocation | 52 // Set the label to use a request size equal to its initial allocation |
53 // size. This causes the label to wrap at the width of the container | 53 // size. This causes the label to wrap at the width of the container |
54 // it is in, instead of at the default width. This is called a hack | 54 // it is in, instead of at the default width. This is called a hack |
55 // because GTK doesn't really work when a widget to make its size | 55 // because GTK doesn't really work when a widget to make its size |
56 // request depend on its allocation. It does, however, have the | 56 // request depend on its allocation. It does, however, have the |
57 // intended effect of wrapping the label at the proper width. | 57 // intended effect of wrapping the label at the proper width. |
58 void WrapLabelAtAllocationHack(GtkWidget* label) { | 58 void WrapLabelAtAllocationHack(GtkWidget* label) { |
59 g_signal_connect(label, "size-allocate", | 59 g_signal_connect(label, "size-allocate", |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 sync_service_->ShowLoginDialog(); | 618 sync_service_->ShowLoginDialog(); |
619 } | 619 } |
620 | 620 |
621 void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response) { | 621 void ContentPageGtk::OnStopSyncDialogResponse(GtkWidget* widget, int response) { |
622 if (response == GTK_RESPONSE_ACCEPT) { | 622 if (response == GTK_RESPONSE_ACCEPT) { |
623 sync_service_->DisableForUser(); | 623 sync_service_->DisableForUser(); |
624 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); | 624 ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS); |
625 } | 625 } |
626 gtk_widget_destroy(widget); | 626 gtk_widget_destroy(widget); |
627 } | 627 } |
OLD | NEW |