Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Side by Side Diff: chrome/browser/gtk/options/content_page_gtk.cc

Issue 1783010: GTK: more signal handler foolproofing. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/gtk/menu_bar_helper.cc ('k') | chrome/browser/gtk/rounded_window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/menu_bar_helper.cc ('k') | chrome/browser/gtk/rounded_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698