xapp-gtk3-module.c: Don't initialize favorites until they're needed.
Since this will run for all gtk3 apps, it should be inactive until
a file chooser is actually created.
Clean up a couple things also.
Michael Webster
3 years ago
0 | /*-*- Mode: C; c-basic-offset: 8 -*-*/ | |
1 | ||
2 | /*** | |
3 | This file is part of libcanberra. | |
4 | ||
5 | Copyright 2008 Lennart Poettering | |
6 | ||
7 | libcanberra is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU Lesser General Public License as | |
9 | published by the Free Software Foundation, either version 2.1 of the | |
10 | License, or (at your option) any later version. | |
11 | ||
12 | libcanberra is distributed in the hope that it will be useful, but | |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | Lesser General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU Lesser General Public | |
18 | License along with libcanberra. If not, see | |
19 | <http://www.gnu.org/licenses/>. | |
20 | ***/ | |
21 | ||
22 | 0 | #include <config.h> |
23 | 1 | #include <gtk/gtk.h> |
24 | 2 | |
66 | 44 | |
67 | 45 | if (!already_applied) |
68 | 46 | { |
47 | xapp_favorites_get_default (); | |
69 | 48 | gtk_file_chooser_add_shortcut_folder_uri (chooser, "favorites:///", NULL); |
70 | 49 | } |
71 | 50 | |
86 | 65 | g_type_class_unref (type_class); |
87 | 66 | } |
88 | 67 | |
89 | G_MODULE_EXPORT void gtk_module_init(gint *argc, gchar ***argv[]) { | |
90 | xapp_favorites_get_default (); | |
68 | G_MODULE_EXPORT void gtk_module_init (gint *argc, gchar ***argv[]) { | |
91 | 69 | add_chooser_hook (GTK_TYPE_FILE_CHOOSER_WIDGET); |
92 | 70 | add_chooser_hook (GTK_TYPE_FILE_CHOOSER_DIALOG); |
93 | 71 | add_chooser_hook (GTK_TYPE_FILE_CHOOSER_BUTTON); |
94 | 72 | } |
95 | 73 | |
96 | G_MODULE_EXPORT gchar* g_module_check_init(GModule *module); | |
74 | G_MODULE_EXPORT gchar* g_module_check_init (GModule *module); | |
97 | 75 | |
98 | G_MODULE_EXPORT gchar* g_module_check_init(GModule *module) { | |
76 | G_MODULE_EXPORT gchar* g_module_check_init (GModule *module) { | |
99 | 77 | g_module_make_resident(module); |
100 | 78 | return NULL; |
101 | 79 | } |