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 <gdk/gdk.h> | 5 #include <gdk/gdk.h> |
6 #include <gdk/gdkx.h> | 6 #include <gdk/gdkx.h> |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... |
35 // Set |dialog| as transient for |parent|, which will keep it on top and center | 35 // Set |dialog| as transient for |parent|, which will keep it on top and center |
36 // it above |parent|. | 36 // it above |parent|. |
37 void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent) { | 37 void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent) { |
38 gtk_widget_realize(dialog); | 38 gtk_widget_realize(dialog); |
39 GdkWindow* gdk_window = gtk_widget_get_window(dialog); | 39 GdkWindow* gdk_window = gtk_widget_get_window(dialog); |
40 | 40 |
41 // TODO(erg): Check to make sure we're using X11 if wayland or some other | 41 // TODO(erg): Check to make sure we're using X11 if wayland or some other |
42 // display server ever happens. Otherwise, this will crash. | 42 // display server ever happens. Otherwise, this will crash. |
43 XSetTransientForHint(GDK_WINDOW_XDISPLAY(gdk_window), | 43 XSetTransientForHint(GDK_WINDOW_XDISPLAY(gdk_window), |
44 GDK_WINDOW_XID(gdk_window), | 44 GDK_WINDOW_XID(gdk_window), |
45 parent->GetDispatcher()->host()->GetAcceleratedWidget()); | 45 parent->GetHost()->GetAcceleratedWidget()); |
46 | 46 |
47 // We also set the |parent| as a property of |dialog|, so that we can unlink | 47 // We also set the |parent| as a property of |dialog|, so that we can unlink |
48 // the two later. | 48 // the two later. |
49 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, parent); | 49 g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, parent); |
50 } | 50 } |
51 | 51 |
52 // Makes sure that .jpg also shows .JPG. | 52 // Makes sure that .jpg also shows .JPG. |
53 gboolean FileFilterCaseInsensitive(const GtkFileFilterInfo* file_info, | 53 gboolean FileFilterCaseInsensitive(const GtkFileFilterInfo* file_info, |
54 std::string* file_extension) { | 54 std::string* file_extension) { |
55 return EndsWith(file_info->filename, *file_extension, false); | 55 return EndsWith(file_info->filename, *file_extension, false); |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 g_free(filename); | 631 g_free(filename); |
632 if (pixbuf) { | 632 if (pixbuf) { |
633 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); | 633 gtk_image_set_from_pixbuf(GTK_IMAGE(preview_), pixbuf); |
634 g_object_unref(pixbuf); | 634 g_object_unref(pixbuf); |
635 } | 635 } |
636 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), | 636 gtk_file_chooser_set_preview_widget_active(GTK_FILE_CHOOSER(chooser), |
637 pixbuf ? TRUE : FALSE); | 637 pixbuf ? TRUE : FALSE); |
638 } | 638 } |
639 | 639 |
640 } // namespace libgtk2ui | 640 } // namespace libgtk2ui |
OLD | NEW |