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

Side by Side Diff: chrome/browser/ui/libgtkui/gtk_status_icon.cc

Issue 2453243002: Gtk3 UI: Rename files in libgtkui containing gtk2 in their name (Closed)
Patch Set: Fix git cl format mistake Created 4 years, 1 month 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/ui/libgtkui/gtk_status_icon.h ('k') | chrome/browser/ui/libgtkui/gtk_ui.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/libgtkui/gtk2_status_icon.h" 5 #include "chrome/browser/ui/libgtkui/gtk_status_icon.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/libgtkui/app_indicator_icon_menu.h" 10 #include "chrome/browser/ui/libgtkui/app_indicator_icon_menu.h"
11 #include "chrome/browser/ui/libgtkui/skia_utils_gtk2.h" 11 #include "chrome/browser/ui/libgtkui/skia_utils_gtk.h"
12 #include "ui/base/models/menu_model.h" 12 #include "ui/base/models/menu_model.h"
13 #include "ui/gfx/image/image_skia.h" 13 #include "ui/gfx/image/image_skia.h"
14 14
15 G_GNUC_BEGIN_IGNORE_DEPRECATIONS 15 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
16 16
17 namespace libgtkui { 17 namespace libgtkui {
18 18
19 Gtk2StatusIcon::Gtk2StatusIcon(const gfx::ImageSkia& image, 19 Gtk2StatusIcon::Gtk2StatusIcon(const gfx::ImageSkia& image,
20 const base::string16& tool_tip) { 20 const base::string16& tool_tip) {
21 GdkPixbuf* pixbuf = GdkPixbufFromSkBitmap(*image.bitmap()); 21 GdkPixbuf* pixbuf = GdkPixbufFromSkBitmap(*image.bitmap());
22 gtk_status_icon_ = gtk_status_icon_new_from_pixbuf(pixbuf); 22 gtk_status_icon_ = gtk_status_icon_new_from_pixbuf(pixbuf);
23 g_object_unref(pixbuf); 23 g_object_unref(pixbuf);
24 24
25 g_signal_connect(gtk_status_icon_, "activate", G_CALLBACK(OnClickThunk), 25 g_signal_connect(gtk_status_icon_, "activate", G_CALLBACK(OnClickThunk),
26 this); 26 this);
27 g_signal_connect(gtk_status_icon_, "popup_menu", 27 g_signal_connect(gtk_status_icon_, "popup_menu",
28 G_CALLBACK(OnContextMenuRequestedThunk), this); 28 G_CALLBACK(OnContextMenuRequestedThunk), this);
29 SetToolTip(tool_tip); 29 SetToolTip(tool_tip);
30 } 30 }
31 31
32 Gtk2StatusIcon::~Gtk2StatusIcon() { 32 Gtk2StatusIcon::~Gtk2StatusIcon() {
33 gtk_status_icon_set_visible(gtk_status_icon_, FALSE); 33 gtk_status_icon_set_visible(gtk_status_icon_, FALSE);
34 g_object_unref(gtk_status_icon_); 34 g_object_unref(gtk_status_icon_);
35 } 35 }
36 36
37 void Gtk2StatusIcon::SetImage(const gfx::ImageSkia& image) { 37 void Gtk2StatusIcon::SetImage(const gfx::ImageSkia& image) {
38 GdkPixbuf* pixbuf = GdkPixbufFromSkBitmap(*image.bitmap()); 38 GdkPixbuf* pixbuf = GdkPixbufFromSkBitmap(*image.bitmap());
(...skipping 19 matching lines...) Expand all
58 58
59 void Gtk2StatusIcon::OnClick(GtkStatusIcon* status_icon) { 59 void Gtk2StatusIcon::OnClick(GtkStatusIcon* status_icon) {
60 if (delegate()) 60 if (delegate())
61 delegate()->OnClick(); 61 delegate()->OnClick();
62 } 62 }
63 63
64 void Gtk2StatusIcon::OnContextMenuRequested(GtkStatusIcon* status_icon, 64 void Gtk2StatusIcon::OnContextMenuRequested(GtkStatusIcon* status_icon,
65 guint button, 65 guint button,
66 guint32 activate_time) { 66 guint32 activate_time) {
67 if (menu_.get()) { 67 if (menu_.get()) {
68 gtk_menu_popup(menu_->GetGtkMenu(), 68 gtk_menu_popup(menu_->GetGtkMenu(), NULL, NULL,
69 NULL, 69 gtk_status_icon_position_menu, gtk_status_icon_, button,
70 NULL,
71 gtk_status_icon_position_menu,
72 gtk_status_icon_,
73 button,
74 activate_time); 70 activate_time);
75 } 71 }
76 } 72 }
77 73
78 } // namespace libgtkui 74 } // namespace libgtkui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_status_icon.h ('k') | chrome/browser/ui/libgtkui/gtk_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698