Tue, 15 Apr 2025 21:45:55 -0500
Fix Pidgin.Application.get_active_window to only return Pidgin.DisplayWindows
Previously we were just returning the first window in the list which is the
most recently created window, which is typically the window that we're trying
to set a transient parent for which obviously doesn't work.
Testing Done:
Opend the channel join and preferences windows and verified the assertion was gone and that i3 didn't full screen the windows.
Also called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/3972/
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Pidgin - Internet Messenger |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * Pidgin is the legal property of its developers, whose names are too numerous |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * source distribution. |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * This program is free software; you can redistribute it and/or modify |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * it under the terms of the GNU General Public License as published by |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * the Free Software Foundation; either version 2 of the License, or |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * (at your option) any later version. |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * This program is distributed in the hope that it will be useful, |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | * GNU General Public License for more details. |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | * |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
42410
563e7a17c220
Fix possible clash of config headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42377
diff
changeset
|
23 | #include <purpleconfig.h> |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #include <glib.h> |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | #include <glib/gi18n-lib.h> |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #include <glib/gstdio.h> |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | #include <gplugin.h> |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | #include <purple.h> |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | |
|
41520
a5dd595361b4
Replace libhandy with libadwaita
Gary Kramlich <grim@reaperworld.com>
parents:
41479
diff
changeset
|
32 | #include <adwaita.h> |
|
40873
68c7ef6c5320
Convert credentials page to use HdyPreferencesGroup and a list box.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40803
diff
changeset
|
33 | |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | #include "pidginapplication.h" |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
36 | #include "pidginabout.h" |
|
41689
e1d3677c844b
Replace calls to the old account editor with the new editor.
Gary Kramlich <grim@reaperworld.com>
parents:
41656
diff
changeset
|
37 | #include "pidginaccounteditor.h" |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
41307
diff
changeset
|
38 | #include "pidginaccountmanager.h" |
|
41450
ce81f2bc04ca
Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
39 | #include "pidginaccountsdisabledmenu.h" |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
40 | #include "pidginaccountsenabledmenu.h" |
|
42377
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
41 | #include "pidginchanneljoindialog.h" |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | #include "pidgincore.h" |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | #include "pidgindebug.h" |
|
41702
4289b30044ed
Rename pidginconversationwindow.[ch] to pidgindisplaywindow.[ch]
Gary Kramlich <grim@reaperworld.com>
parents:
41696
diff
changeset
|
44 | #include "pidgindisplaywindow.h" |
|
41414
b76bc2b4d7cc
Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
45 | #include "pidginpluginsmenu.h" |
|
41867
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41853
diff
changeset
|
46 | #include "pidginprefs.h" |
|
5375c1d58c50
Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents:
41853
diff
changeset
|
47 | #include "pidginui.h" |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
49 | struct _PidginApplication { |
|
42361
59f54c17c61f
Make PidginApplication subclass AdwApplication
Gary Kramlich <grim@reaperworld.com>
parents:
42291
diff
changeset
|
50 | AdwApplication parent; |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
51 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
52 | GHashTable *action_groups; |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
53 | }; |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
54 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
55 | /****************************************************************************** |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
56 | * Globals |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
57 | *****************************************************************************/ |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
58 | static char *opt_config_dir_arg = NULL; |
|
41336
844484fb31aa
The debug command line option does not actually take an argument.
Stu Tomlinson <stu@nosnilmot.com>
parents:
41320
diff
changeset
|
59 | static gboolean opt_debug = FALSE; |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | static gboolean opt_nologin = FALSE; |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
61 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | static GOptionEntry option_entries[] = { |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | { |
|
42958
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
64 | .long_name = "config", |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
65 | .short_name = 'c', |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
66 | .arg = G_OPTION_ARG_FILENAME, |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
67 | .arg_data = &opt_config_dir_arg, |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
68 | .description = N_("use DIR for config files"), |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
69 | .arg_description = N_("DIR"), |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | }, { |
|
42958
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
71 | .long_name = "debug", |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
72 | .short_name = 'd', |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
73 | .arg = G_OPTION_ARG_NONE, |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
74 | .arg_data = &opt_debug, |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
75 | .description = N_("print debugging messages to stdout"), |
|
41127
cd297cfc56f3
Move debug command-line option to the UIs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41117
diff
changeset
|
76 | }, { |
|
42958
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
77 | .long_name = "nologin", |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
78 | .short_name = 'n', |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
79 | .arg = G_OPTION_ARG_NONE, |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
80 | .arg_data = &opt_nologin, |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
81 | .description = N_("don't automatically login"), |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | }, |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | { |
|
42958
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
84 | .long_name = "version", |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
85 | .short_name = 'v', |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
86 | .arg = G_OPTION_ARG_NONE, |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
87 | .description = N_("display the current version and exit"), |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
88 | }, |
|
5086e3c19207
Modernize GOptionEntry style in PidginApplication
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42950
diff
changeset
|
89 | G_OPTION_ENTRY_NULL, |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | }; |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | |
|
42575
580339aa47cc
Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42562
diff
changeset
|
92 | G_DEFINE_FINAL_TYPE(PidginApplication, pidgin_application, |
|
580339aa47cc
Make sure all of the final types in pidgin are defined as such
Gary Kramlich <grim@reaperworld.com>
parents:
42562
diff
changeset
|
93 | ADW_TYPE_APPLICATION) |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | /****************************************************************************** |
|
41169
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
96 | * Helpers |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
97 | *****************************************************************************/ |
|
41634
f73f2b9c75b4
Do our best to set a transient parent for all of our dialogs
Gary Kramlich <grim@reaperworld.com>
parents:
41630
diff
changeset
|
98 | |
|
f73f2b9c75b4
Do our best to set a transient parent for all of our dialogs
Gary Kramlich <grim@reaperworld.com>
parents:
41630
diff
changeset
|
99 | /* |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
100 | * pidgin_application_get_account_manager: |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
101 | * |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
102 | * The Pidgin account manager can get opened from multiple actions, so this |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
103 | * helper manages the singleton. |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
104 | * |
|
42620
72178a341eb8
Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42575
diff
changeset
|
105 | * Since: 3.0 |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
106 | */ |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
107 | static GtkWidget * |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
108 | pidgin_application_get_account_manager(PidginApplication *application) { |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
109 | static GtkWidget *manager = NULL; |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
110 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
111 | if(!PIDGIN_IS_ACCOUNT_MANAGER(manager)) { |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
112 | manager = pidgin_account_manager_new(GTK_APPLICATION(application)); |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
113 | g_object_add_weak_pointer(G_OBJECT(manager), (gpointer)&manager); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
114 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
115 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
116 | return manager; |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
117 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
118 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
119 | /* |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
120 | * pidgin_application_present_transient_window: |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
121 | * @application: The application instance. |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
122 | * @window: The [class@Gtk.Window] to present. |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
123 | * |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
124 | * Presents a window and makes sure its transient parent is set to the currently |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
125 | * active window of @application. |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
126 | * |
|
42620
72178a341eb8
Remove minor versions from Since tags in Pidgin
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42575
diff
changeset
|
127 | * Since: 3.0 |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
128 | */ |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
129 | static void |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
130 | pidgin_application_present_transient_window(PidginApplication *application, |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
131 | GtkWindow *window) |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
132 | { |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
133 | GtkWindow *active_window = NULL; |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
134 | |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
135 | g_return_if_fail(PIDGIN_IS_APPLICATION(application)); |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
136 | g_return_if_fail(GTK_IS_WINDOW(window)); |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
137 | |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
138 | active_window = pidgin_application_get_active_window(application); |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
139 | |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
140 | gtk_window_set_transient_for(window, active_window); |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
141 | |
|
42858
a227c1f6c299
Use gtk_window_present instead of gtk_window_present_with_time
Gary Kramlich <grim@reaperworld.com>
parents:
42746
diff
changeset
|
142 | gtk_window_present(window); |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
143 | } |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
144 | |
|
41651
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
145 | static void |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
146 | pidgin_application_plugin_state_changed(G_GNUC_UNUSED GPluginManager *manager, |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
147 | G_GNUC_UNUSED GPluginPlugin *plugin, |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
148 | G_GNUC_UNUSED gpointer data) |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
149 | { |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
150 | purple_plugins_save_loaded(PIDGIN_PREFS_ROOT "/plugins/loaded"); |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
151 | } |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
152 | |
|
41169
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
153 | static void |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
154 | pidgin_application_init_plugins(void) { |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
155 | GPluginManager *manager = gplugin_manager_get_default(); |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
156 | |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
157 | gplugin_manager_append_paths_from_environment(manager, |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
158 | "PIDGIN_PLUGIN_PATH"); |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
159 | |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
160 | if(g_getenv("PURPLE_PLUGINS_SKIP")) { |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
161 | g_message("PURPLE_PLUGINS_SKIP environment variable set, skipping " |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
162 | "normal Pidgin plugin paths"); |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
163 | } else { |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
164 | char *path = g_build_filename(purple_data_dir(), "plugins", NULL); |
|
41169
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
165 | |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
166 | if(!g_file_test(path, G_FILE_TEST_IS_DIR)) { |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
167 | g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR); |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
168 | } |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
169 | |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
170 | gplugin_manager_append_path(manager, path); |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
171 | g_free(path); |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
172 | |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
173 | gplugin_manager_append_path(manager, PIDGIN_LIBDIR); |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
174 | } |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
175 | |
|
41651
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
176 | g_signal_connect(manager, "loaded-plugin", |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
177 | G_CALLBACK(pidgin_application_plugin_state_changed), NULL); |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
178 | g_signal_connect(manager, "load-plugin-failed", |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
179 | G_CALLBACK(pidgin_application_plugin_state_changed), NULL); |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
180 | g_signal_connect(manager, "unloaded-plugin", |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
181 | G_CALLBACK(pidgin_application_plugin_state_changed), NULL); |
|
41656
da54a3c1e468
Fix typo in signal name
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41651
diff
changeset
|
182 | g_signal_connect(manager, "unload-plugin-failed", |
|
41651
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
183 | G_CALLBACK(pidgin_application_plugin_state_changed), NULL); |
|
eba22f6af173
Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41634
diff
changeset
|
184 | |
|
41169
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
185 | purple_plugins_refresh(); |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
186 | } |
|
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
187 | |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
188 | static void |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
189 | pidgin_application_populate_dynamic_menus(PidginApplication *application) { |
|
41457
f0e7534a555d
Convert PidginAccountsEnabledMenu from a menu controller to a GMenuModel
Gary Kramlich <grim@reaperworld.com>
parents:
41454
diff
changeset
|
190 | GMenu *target = NULL; |
|
41315
1c9f47bbc031
Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
191 | GMenuModel *model = NULL; |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
192 | |
|
41450
ce81f2bc04ca
Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
193 | /* Link the AccountsDisabledMenu into its proper location. */ |
|
ce81f2bc04ca
Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
194 | model = pidgin_accounts_disabled_menu_new(); |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
195 | target = gtk_application_get_menu_by_id(GTK_APPLICATION(application), |
|
41450
ce81f2bc04ca
Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents:
41441
diff
changeset
|
196 | "disabled-accounts"); |
|
41315
1c9f47bbc031
Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
197 | g_menu_append_section(target, NULL, model); |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
198 | |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
199 | /* Link the AccountsEnabledMenu into its proper location. */ |
|
41457
f0e7534a555d
Convert PidginAccountsEnabledMenu from a menu controller to a GMenuModel
Gary Kramlich <grim@reaperworld.com>
parents:
41454
diff
changeset
|
200 | model = pidgin_accounts_enabled_menu_new(); |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
201 | target = gtk_application_get_menu_by_id(GTK_APPLICATION(application), |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
202 | "enabled-accounts"); |
|
41457
f0e7534a555d
Convert PidginAccountsEnabledMenu from a menu controller to a GMenuModel
Gary Kramlich <grim@reaperworld.com>
parents:
41454
diff
changeset
|
203 | g_menu_append_section(target, NULL, model); |
|
41414
b76bc2b4d7cc
Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
204 | |
|
b76bc2b4d7cc
Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
205 | /* Link the PluginsMenu into its proper location. */ |
|
b76bc2b4d7cc
Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
206 | model = pidgin_plugins_menu_new(); |
|
b76bc2b4d7cc
Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
207 | target = gtk_application_get_menu_by_id(GTK_APPLICATION(application), |
|
b76bc2b4d7cc
Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
208 | "plugins-menu"); |
|
b76bc2b4d7cc
Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents:
41396
diff
changeset
|
209 | g_menu_append_section(target, NULL, model); |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
210 | } |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
211 | |
|
42886
d9d26508be61
Automatically turn on print debugging in debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42873
diff
changeset
|
212 | static void |
|
d9d26508be61
Automatically turn on print debugging in debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42873
diff
changeset
|
213 | pidgin_application_setup_debug(G_GNUC_UNUSED PidginApplication *application) { |
|
d9d26508be61
Automatically turn on print debugging in debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42873
diff
changeset
|
214 | pidgin_debug_init_handler(); |
|
d9d26508be61
Automatically turn on print debugging in debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42873
diff
changeset
|
215 | |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
216 | #ifdef PURPLE_DEBUG |
|
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
217 | pidgin_debug_set_print_enabled(TRUE); |
|
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
218 | #else /* PURPLE_DEBUG */ |
|
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
219 | pidgin_debug_set_print_enabled(opt_debug); |
|
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
220 | #endif /* PURPLE_DEBUG */ |
|
42886
d9d26508be61
Automatically turn on print debugging in debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42873
diff
changeset
|
221 | } |
|
d9d26508be61
Automatically turn on print debugging in debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42873
diff
changeset
|
222 | |
|
42950
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
223 | static void |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
224 | pidgin_application_add_debug_notification(G_GNUC_UNUSED PidginApplication *application) |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
225 | { |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
226 | #ifdef PURPLE_DEBUG |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
227 | PurpleNotification *notification = NULL; |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
228 | PurpleNotificationManager *manager = NULL; |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
229 | |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
230 | notification = purple_notification_link_new(NULL, |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
231 | _("Unreleased Version"), |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
232 | _("Issue Tracker"), |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
233 | "https://issues.imfreedom.org/issues/PIDGIN"); |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
234 | purple_notification_set_subtitle(notification, |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
235 | _("This is an unreleased version of " |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
236 | "Pidgin which means things will be " |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
237 | "broken. Please check our issue " |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
238 | "tracker before reporting bugs.")); |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
239 | purple_notification_set_icon_name(notification, "im.pidgin.Pidgin3"); |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
240 | purple_notification_set_persistent(notification, TRUE); |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
241 | |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
242 | manager = purple_notification_manager_get_default(); |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
243 | purple_notification_manager_add(manager, notification); |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
244 | g_clear_object(¬ification); |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
245 | #endif /* PURPLE_DEBUG */ |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
246 | } |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
247 | |
|
41169
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
248 | /****************************************************************************** |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
249 | * Actions |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
250 | *****************************************************************************/ |
|
41479
3d2e114380f6
Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41457
diff
changeset
|
251 | /*< private > |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
252 | * pidgin_application_online_actions: |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
253 | * |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
254 | * This list keeps track of which actions should only be enabled while online. |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
255 | */ |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
256 | static const char *pidgin_application_online_actions[] = { |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
257 | }; |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
258 | |
|
42377
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
259 | /** |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
260 | * pidgin_application_channel_actions: (skip) |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
261 | * |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
262 | * This list keeps track of which actions should only be enabled if a protocol |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
263 | * supporting channels is connected. |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
264 | */ |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
265 | static const char *pidgin_application_channel_actions[] = { |
|
42377
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
266 | "join-channel", |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
267 | }; |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
268 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
269 | /** |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
270 | * pidgin_action_group_actions_set_enable: (skip) |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
271 | * @group: The #PidginActionGroup instance. |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
272 | * @actions: The action names. |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
273 | * @n_actions: The number of @actions. |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
274 | * @enabled: Whether or not to enable the actions. |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
275 | * |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
276 | * Sets the enabled property of the named actions to @enabled. |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
277 | */ |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
278 | static void |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
279 | pidgin_application_actions_set_enabled(PidginApplication *application, |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
280 | const char *const *actions, |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
281 | guint n_actions, |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
282 | gboolean enabled) |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
283 | { |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
284 | for(guint i = 0; i < n_actions; i++) { |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
285 | GAction *action = NULL; |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
286 | const char *name = actions[i]; |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
287 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
288 | action = g_action_map_lookup_action(G_ACTION_MAP(application), name); |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
289 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
290 | if(action != NULL) { |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
291 | g_simple_action_set_enabled(G_SIMPLE_ACTION(action), enabled); |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
292 | } else { |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
293 | g_warning("Failed to find action named %s", name); |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
294 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
295 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
296 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
297 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
298 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
299 | pidgin_application_about(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
300 | G_GNUC_UNUSED GVariant *parameter, gpointer data) |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
301 | { |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
302 | PidginApplication *application = data; |
|
41307
685bab46fad2
Move the singleton handling of the about dialog to the action handler.
Gary Kramlich <grim@reaperworld.com>
parents:
41306
diff
changeset
|
303 | static GtkWidget *about = NULL; |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
304 | |
|
41307
685bab46fad2
Move the singleton handling of the about dialog to the action handler.
Gary Kramlich <grim@reaperworld.com>
parents:
41306
diff
changeset
|
305 | if(!GTK_IS_WIDGET(about)) { |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
306 | about = pidgin_about_dialog_new(GTK_APPLICATION(application)); |
|
41307
685bab46fad2
Move the singleton handling of the about dialog to the action handler.
Gary Kramlich <grim@reaperworld.com>
parents:
41306
diff
changeset
|
307 | g_object_add_weak_pointer(G_OBJECT(about), (gpointer)&about); |
|
685bab46fad2
Move the singleton handling of the about dialog to the action handler.
Gary Kramlich <grim@reaperworld.com>
parents:
41306
diff
changeset
|
308 | } |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
309 | |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
310 | pidgin_application_present_transient_window(application, GTK_WINDOW(about)); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
311 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
312 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
313 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
314 | pidgin_application_accounts(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
315 | G_GNUC_UNUSED GVariant *parameter, gpointer data) |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
316 | { |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
317 | PidginApplication *application = data; |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
318 | GtkWidget *manager = pidgin_application_get_account_manager(application); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
41307
diff
changeset
|
319 | |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
320 | pidgin_account_manager_show_overview(PIDGIN_ACCOUNT_MANAGER(manager)); |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
41307
diff
changeset
|
321 | |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
322 | pidgin_application_present_transient_window(application, |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
323 | GTK_WINDOW(manager)); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
324 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
325 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
326 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
327 | pidgin_application_connect_account(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
328 | GVariant *parameter, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
329 | G_GNUC_UNUSED gpointer data) |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
330 | { |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
331 | PurpleAccount *account = NULL; |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
332 | PurpleAccountManager *manager = NULL; |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
333 | const char *id = NULL; |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
334 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
335 | id = g_variant_get_string(parameter, NULL); |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
336 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
337 | manager = purple_account_manager_get_default(); |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
338 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
339 | account = purple_account_manager_find_by_id(manager, id); |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
340 | if(PURPLE_IS_ACCOUNT(account)) { |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
341 | purple_account_connect(account); |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42163
diff
changeset
|
342 | g_clear_object(&account); |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
343 | } |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
344 | } |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
345 | |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
346 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
347 | pidgin_application_debug(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
348 | G_GNUC_UNUSED GVariant *parameter, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
349 | G_GNUC_UNUSED gpointer data) |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
350 | { |
|
43009
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
351 | GSettings *settings = NULL; |
|
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
352 | gboolean old = FALSE; |
|
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
353 | |
|
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
354 | settings = pidgin_debug_get_settings(); |
|
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
355 | old = g_settings_get_boolean(settings, "visible"); |
|
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
356 | g_settings_set_boolean(settings, "visible", !old); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
357 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
358 | |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
359 | |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
360 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
361 | pidgin_application_disable_account(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
362 | GVariant *parameter, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
363 | G_GNUC_UNUSED gpointer data) |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
364 | { |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
365 | PurpleAccount *account = NULL; |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
366 | PurpleAccountManager *manager = NULL; |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
367 | const char *id = NULL; |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
368 | |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
369 | id = g_variant_get_string(parameter, NULL); |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
370 | |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
371 | manager = purple_account_manager_get_default(); |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
372 | |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
373 | account = purple_account_manager_find_by_id(manager, id); |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
374 | if(PURPLE_IS_ACCOUNT(account)) { |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41354
diff
changeset
|
375 | if(purple_account_get_enabled(account)) { |
|
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41354
diff
changeset
|
376 | purple_account_set_enabled(account, FALSE); |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
377 | } |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42163
diff
changeset
|
378 | |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42163
diff
changeset
|
379 | g_clear_object(&account); |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
380 | } |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
381 | } |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
382 | |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
383 | static void |
|
41932
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
384 | pidgin_application_donate(G_GNUC_UNUSED GSimpleAction *simple, |
|
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
385 | G_GNUC_UNUSED GVariant *parameter, |
|
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
386 | G_GNUC_UNUSED gpointer data) |
|
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
387 | { |
|
42746
bd2da74b9201
Use GtkUriLauncher directly in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42739
diff
changeset
|
388 | GtkUriLauncher *launcher = NULL; |
|
bd2da74b9201
Use GtkUriLauncher directly in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42739
diff
changeset
|
389 | |
|
bd2da74b9201
Use GtkUriLauncher directly in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42739
diff
changeset
|
390 | launcher = gtk_uri_launcher_new("https://www.imfreedom.org/donate/"); |
|
bd2da74b9201
Use GtkUriLauncher directly in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42739
diff
changeset
|
391 | gtk_uri_launcher_launch(launcher, NULL, NULL, NULL, NULL); |
|
bd2da74b9201
Use GtkUriLauncher directly in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42739
diff
changeset
|
392 | g_clear_object(&launcher); |
|
41932
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
393 | } |
|
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
394 | |
|
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
395 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
396 | pidgin_application_edit_account(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
397 | GVariant *parameter, gpointer data) |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
398 | { |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
399 | PidginApplication *application = data; |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
400 | PurpleAccount *account = NULL; |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
401 | PurpleAccountManager *manager = NULL; |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
402 | const char *id = NULL; |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
403 | |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
404 | if(!g_variant_is_of_type(parameter, G_VARIANT_TYPE_STRING)) { |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
405 | g_warning("parameter is of type %s, expected %s", |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
406 | g_variant_get_type_string(parameter), |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
407 | (char *)G_VARIANT_TYPE_STRING); |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
408 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
409 | return; |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
410 | } |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
411 | |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
412 | id = g_variant_get_string(parameter, NULL); |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
413 | |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
414 | manager = purple_account_manager_get_default(); |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
415 | |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
416 | account = purple_account_manager_find_by_id(manager, id); |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
417 | if(PURPLE_IS_ACCOUNT(account)) { |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
418 | GtkWidget *account_manager = NULL; |
|
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
419 | |
|
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
420 | account_manager = pidgin_application_get_account_manager(application); |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
421 | |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
422 | pidgin_account_manager_edit_account(PIDGIN_ACCOUNT_MANAGER(account_manager), |
|
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
423 | account); |
|
41708
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
424 | |
|
ab84e1ca8935
Make a bunch of windows transient and use gtk_window_present_with_time instead of just gtk_widget_show
Gary Kramlich <grim@reaperworld.com>
parents:
41702
diff
changeset
|
425 | pidgin_application_present_transient_window(application, |
|
42151
41b9c5be8965
Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents:
42072
diff
changeset
|
426 | GTK_WINDOW(account_manager)); |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42163
diff
changeset
|
427 | |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42163
diff
changeset
|
428 | g_clear_object(&account); |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
429 | } |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
430 | } |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
431 | |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
432 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
433 | pidgin_application_enable_account(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
434 | GVariant *parameter, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
435 | G_GNUC_UNUSED gpointer data) |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
436 | { |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
437 | PurpleAccount *account = NULL; |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
438 | PurpleAccountManager *manager = NULL; |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
439 | const char *id = NULL; |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
440 | |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
441 | id = g_variant_get_string(parameter, NULL); |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
442 | |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
443 | manager = purple_account_manager_get_default(); |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
444 | |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
445 | account = purple_account_manager_find_by_id(manager, id); |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
446 | if(PURPLE_IS_ACCOUNT(account)) { |
|
41392
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41354
diff
changeset
|
447 | if(!purple_account_get_enabled(account)) { |
|
b5c84f55d5d2
Remove the ui parameter from purple_account_[gs]et_enabled
Gary Kramlich <grim@reaperworld.com>
parents:
41354
diff
changeset
|
448 | purple_account_set_enabled(account, TRUE); |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
449 | } |
|
42291
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42163
diff
changeset
|
450 | |
|
a86b7bcbb471
Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents:
42163
diff
changeset
|
451 | g_clear_object(&account); |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
452 | } |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
453 | } |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
454 | |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
455 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
456 | pidgin_application_file_transfers(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
457 | G_GNUC_UNUSED GVariant *parameter, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
458 | G_GNUC_UNUSED gpointer data) |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
459 | { |
|
42517
9d1bf2e19825
Remove the old gtk file transfer stuff
Gary Kramlich <grim@reaperworld.com>
parents:
42512
diff
changeset
|
460 | g_warning("sorry not yet ported..."); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
461 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
462 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
463 | static void |
|
42377
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
464 | pidgin_application_join_channel(G_GNUC_UNUSED GSimpleAction *simple, |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
465 | G_GNUC_UNUSED GVariant *parameter, |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
466 | gpointer data) |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
467 | { |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
468 | PidginApplication *application = data; |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
469 | static GtkWidget *dialog = NULL; |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
470 | |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
471 | if(!GTK_IS_WIDGET(dialog)) { |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
472 | dialog = pidgin_channel_join_dialog_new(GTK_APPLICATION(application)); |
|
42377
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
473 | g_object_add_weak_pointer(G_OBJECT(dialog), (gpointer)&dialog); |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
474 | } |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
475 | |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
476 | pidgin_application_present_transient_window(application, |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
477 | GTK_WINDOW(dialog)); |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
478 | } |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
479 | |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
480 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
481 | pidgin_application_online_help(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
482 | G_GNUC_UNUSED GVariant *parameter, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
483 | G_GNUC_UNUSED gpointer data) |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
484 | { |
|
42913
3da85f0c0ee6
Implement Purple.Ui.open_uri_async in Pidgin.Ui
Gary Kramlich <grim@reaperworld.com>
parents:
42886
diff
changeset
|
485 | PurpleUi *ui = NULL; |
|
42746
bd2da74b9201
Use GtkUriLauncher directly in Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42739
diff
changeset
|
486 | |
|
42913
3da85f0c0ee6
Implement Purple.Ui.open_uri_async in Pidgin.Ui
Gary Kramlich <grim@reaperworld.com>
parents:
42886
diff
changeset
|
487 | ui = purple_core_get_ui(); |
|
3da85f0c0ee6
Implement Purple.Ui.open_uri_async in Pidgin.Ui
Gary Kramlich <grim@reaperworld.com>
parents:
42886
diff
changeset
|
488 | purple_ui_open_uri(ui, PURPLE_WEBSITE "help", NULL, NULL, NULL); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
489 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
490 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
491 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
492 | pidgin_application_preferences(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
493 | G_GNUC_UNUSED GVariant *parameter, |
|
42072
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
494 | gpointer data) |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
495 | { |
|
42072
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
496 | PidginApplication *application = data; |
|
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
497 | static GtkWidget *preferences = NULL; |
|
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
498 | |
|
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
499 | if(!GTK_IS_WIDGET(preferences)) { |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
500 | preferences = g_object_new( |
|
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
501 | PIDGIN_TYPE_PREFS_WINDOW, |
|
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
502 | "application", application, |
|
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
503 | NULL); |
|
42072
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
504 | g_object_add_weak_pointer(G_OBJECT(preferences), (gpointer)&preferences); |
|
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
505 | } |
|
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
506 | |
|
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
507 | pidgin_application_present_transient_window(application, |
|
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
508 | GTK_WINDOW(preferences)); |
|
606edc665dc2
Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents:
42061
diff
changeset
|
509 | |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
510 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
511 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
512 | static void |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
513 | pidgin_application_quit(G_GNUC_UNUSED GSimpleAction *simple, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
514 | G_GNUC_UNUSED GVariant *parameter, |
|
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
515 | G_GNUC_UNUSED gpointer data) |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
516 | { |
|
41853
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
517 | GPluginManager *manager = NULL; |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
518 | |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
519 | /* Remove the signal handlers for plugin state changing so we don't try to |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
520 | * update preferences. |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
521 | */ |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
522 | manager = gplugin_manager_get_default(); |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
523 | g_signal_handlers_disconnect_by_func(manager, |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
524 | pidgin_application_plugin_state_changed, |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
525 | NULL); |
|
d5fe1ee0efae
Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents:
41748
diff
changeset
|
526 | |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
527 | purple_core_quit(); |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
528 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
529 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
530 | static GActionEntry app_entries[] = { |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
531 | { |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
532 | .name = "about", |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
533 | .activate = pidgin_application_about, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
534 | }, { |
|
41441
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
535 | .name = "connect-account", |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
536 | .activate = pidgin_application_connect_account, |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
537 | .parameter_type = "s", |
|
e114ed471a1e
Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents:
41416
diff
changeset
|
538 | }, { |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
539 | .name = "debug", |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
540 | .activate = pidgin_application_debug, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
541 | }, { |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
542 | .name = "disable-account", |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
543 | .activate = pidgin_application_disable_account, |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
544 | .parameter_type = "s", |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
545 | }, { |
|
41932
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
546 | .name = "donate", |
|
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
547 | .activate = pidgin_application_donate, |
|
0c3de459b1cc
Add a donate link under the help menu and move the debug window item to the tools menu
Gary Kramlich <grim@reaperworld.com>
parents:
41872
diff
changeset
|
548 | }, { |
|
41304
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
549 | .name = "edit-account", |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
550 | .activate = pidgin_application_edit_account, |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
551 | .parameter_type = "s", |
|
25830cad9bfc
Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents:
41303
diff
changeset
|
552 | }, { |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
553 | .name = "enable-account", |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
554 | .activate = pidgin_application_enable_account, |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
555 | .parameter_type = "s", |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
556 | }, { |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
557 | .name = "file-transfers", |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
558 | .activate = pidgin_application_file_transfers, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
559 | }, { |
|
42377
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
560 | .name = "join-channel", |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
561 | .activate = pidgin_application_join_channel, |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
562 | }, { |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
563 | .name = "manage-accounts", |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
564 | .activate = pidgin_application_accounts, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
565 | }, { |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
566 | .name = "online-help", |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
567 | .activate = pidgin_application_online_help, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
568 | }, { |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
569 | .name = "preferences", |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
570 | .activate = pidgin_application_preferences, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
571 | }, { |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
572 | .name = "quit", |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
573 | .activate = pidgin_application_quit, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
574 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
575 | }; |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
576 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
577 | /****************************************************************************** |
|
42561
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
578 | * Shortcuts |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
579 | *****************************************************************************/ |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
580 | static inline void |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
581 | pidgin_application_add_shortcut(PidginApplication *application, |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
582 | const char *action, |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
583 | const char *accelerator) |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
584 | { |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
585 | const char *accels[] = {accelerator, NULL}; |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
586 | |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
587 | gtk_application_set_accels_for_action(GTK_APPLICATION(application), |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
588 | action, accels); |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
589 | } |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
590 | |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
591 | static void |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
592 | pidgin_application_add_shortcuts(PidginApplication *application) { |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
593 | pidgin_application_add_shortcut(application, "app.file-transfers", |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
594 | "<Primary>T"); |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
595 | pidgin_application_add_shortcut(application, "app.get-user-info", |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
596 | "<Primary>I"); |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
597 | pidgin_application_add_shortcut(application, "app.manage-accounts", |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
598 | "<Primary>S"); |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
599 | pidgin_application_add_shortcut(application, "app.manage-plugins", |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
600 | "<Primary>U"); |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
601 | pidgin_application_add_shortcut(application, "app.new-message", |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
602 | "<Primary>M"); |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
603 | pidgin_application_add_shortcut(application, "app.preferences", |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
604 | "<Primary>comma"); |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
605 | pidgin_application_add_shortcut(application, "app.quit", "<Primary>Q"); |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
606 | } |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
607 | |
|
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
608 | /****************************************************************************** |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
609 | * Callbacks |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
610 | *****************************************************************************/ |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
611 | static void |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
612 | pidgin_application_connected_cb(G_GNUC_UNUSED PurpleAccountManager *manager, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
613 | PurpleAccount *account, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
614 | gpointer data) |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
615 | { |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
616 | PidginApplication *application = data; |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
617 | PurpleProtocol *protocol = NULL; |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
618 | gboolean should_enable_channel = FALSE; |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
619 | guint n_actions = 0; |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
620 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
621 | n_actions = G_N_ELEMENTS(pidgin_application_online_actions); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
622 | pidgin_application_actions_set_enabled(PIDGIN_APPLICATION(data), |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
623 | pidgin_application_online_actions, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
624 | n_actions, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
625 | TRUE); |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
626 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
627 | /* Now figure out what menus items should be enabled. */ |
|
40803
0e11ce1049b2
Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents:
40683
diff
changeset
|
628 | protocol = purple_account_get_protocol(account); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
629 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
630 | /* We assume that the current state is correct, so we don't bother changing |
|
42558
05f7fd3db190
Remove some left over code for enabling and disabling actions that is no longer necessary
Gary Kramlich <grim@reaperworld.com>
parents:
42551
diff
changeset
|
631 | * state unless the newly connected account implements the channel virtual |
|
05f7fd3db190
Remove some left over code for enabling and disabling actions that is no longer necessary
Gary Kramlich <grim@reaperworld.com>
parents:
42551
diff
changeset
|
632 | * functions, which would cause a state change. |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
633 | */ |
|
42377
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
634 | should_enable_channel = PURPLE_PROTOCOL_IMPLEMENTS(protocol, CONVERSATION, |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
635 | get_channel_join_details); |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
636 | if(should_enable_channel) { |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
637 | n_actions = G_N_ELEMENTS(pidgin_application_channel_actions); |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
638 | pidgin_application_actions_set_enabled(application, |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
639 | pidgin_application_channel_actions, |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
640 | n_actions, |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
641 | TRUE); |
|
6e3f1f8709b5
Create a new PidginChannelJoinDialog widget
Gary Kramlich <grim@reaperworld.com>
parents:
42366
diff
changeset
|
642 | } |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
643 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
644 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
645 | static void |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
646 | pidgin_application_disconnected_cb(PurpleAccountManager *manager, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
647 | G_GNUC_UNUSED PurpleAccount *account, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
648 | gpointer data) |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
649 | { |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
650 | PidginApplication *application = data; |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
651 | GList *connected = NULL; |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
652 | gboolean should_disable_actions = TRUE; |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
653 | gboolean should_disable_channel = TRUE; |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
654 | guint n_actions = 0; |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
655 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
656 | connected = purple_account_manager_get_connected(manager); |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
657 | |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
658 | while(connected != NULL) { |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
659 | PurpleAccount *account = connected->data; |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
660 | PurpleProtocol *protocol = NULL; |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
661 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
662 | /* We have at least one account connected so we're online. */ |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
663 | should_disable_actions = FALSE; |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
664 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
665 | protocol = purple_account_get_protocol(account); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
666 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
667 | /* Check if the protocol implements joining channels. */ |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
668 | if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, CONVERSATION, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
669 | get_channel_join_details)) |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
670 | { |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
671 | should_disable_channel = FALSE; |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
672 | } |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
673 | |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
674 | /* If we can't disable anything we can exit the loop early. */ |
|
42718
b87a01be99af
Remove the roomlist from Pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
42712
diff
changeset
|
675 | if(!should_disable_channel) { |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
676 | g_clear_list(&connected, NULL); |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
677 | |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
678 | break; |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
679 | } |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
680 | |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
681 | connected = g_list_delete_link(connected, connected); |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
682 | } |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
683 | |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
684 | if(should_disable_actions) { |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
685 | n_actions = G_N_ELEMENTS(pidgin_application_online_actions); |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
686 | pidgin_application_actions_set_enabled(PIDGIN_APPLICATION(data), |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
687 | pidgin_application_online_actions, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
688 | n_actions, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
689 | FALSE); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
690 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
691 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
692 | if(should_disable_channel) { |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
693 | n_actions = G_N_ELEMENTS(pidgin_application_channel_actions); |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
694 | pidgin_application_actions_set_enabled(application, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
695 | pidgin_application_channel_actions, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
696 | n_actions, |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
697 | FALSE); |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
698 | } |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
699 | } |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
700 | |
|
41872
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
701 | static void |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
702 | pidgin_application_error_reponse_cb(G_GNUC_UNUSED AdwMessageDialog *self, |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
703 | G_GNUC_UNUSED char *response, |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
704 | gpointer data) |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
705 | { |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
706 | g_application_quit(data); |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
707 | } |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
708 | |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
709 | /****************************************************************************** |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
710 | * GtkApplication Implementation |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
711 | *****************************************************************************/ |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
712 | static void |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
713 | pidgin_application_window_added(GtkApplication *application, |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
714 | GtkWindow *window) |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
715 | { |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
716 | PidginApplication *pidgin_application = PIDGIN_APPLICATION(application); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
717 | GHashTableIter iter; |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
718 | gpointer key, value; |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
719 | |
|
41354
ba08026458f4
Chain up to the parent class's implementation of the window_added default signal handler
Gary Kramlich <grim@reaperworld.com>
parents:
41353
diff
changeset
|
720 | GTK_APPLICATION_CLASS(pidgin_application_parent_class)->window_added(application, |
|
ba08026458f4
Chain up to the parent class's implementation of the window_added default signal handler
Gary Kramlich <grim@reaperworld.com>
parents:
41353
diff
changeset
|
721 | window); |
|
ba08026458f4
Chain up to the parent class's implementation of the window_added default signal handler
Gary Kramlich <grim@reaperworld.com>
parents:
41353
diff
changeset
|
722 | |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
723 | #ifdef PURPLE_DEBUG |
|
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
724 | gtk_widget_add_css_class(GTK_WIDGET(window), "devel"); |
|
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
725 | #endif /* PURPLE_DEBUG */ |
|
41695
6032b86cb76b
Add devel CSS to application windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41689
diff
changeset
|
726 | |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
727 | g_hash_table_iter_init(&iter, pidgin_application->action_groups); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
728 | while(g_hash_table_iter_next(&iter, &key, &value)) { |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
729 | GActionGroup *action_group = value; |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
730 | char *prefix = key; |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
731 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
732 | gtk_widget_insert_action_group(GTK_WIDGET(window), prefix, |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
733 | action_group); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
734 | } |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
735 | } |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
736 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
737 | /****************************************************************************** |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
738 | * GApplication Implementation |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
739 | *****************************************************************************/ |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
740 | static void |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
741 | pidgin_application_startup(GApplication *application) { |
|
41209
909561f42b1f
port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents:
41169
diff
changeset
|
742 | PurpleAccountManager *manager = NULL; |
|
43009
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
743 | GSettings *debug_settings = NULL; |
|
41868
e69cbf7921ec
Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents:
41867
diff
changeset
|
744 | GError *error = NULL; |
|
43219
778ca78c80c9
Port PidginApplication to purple_account_manager_get_enabled_model
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43085
diff
changeset
|
745 | GListModel *active_accounts = NULL; |
|
42991
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
746 | gboolean online = FALSE; |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
747 | int n_actions = 0; |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
748 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
749 | G_APPLICATION_CLASS(pidgin_application_parent_class)->startup(application); |
|
41524
f0a68067cff5
Update PidginApplication for the changes in GTK4
Gary Kramlich <grim@reaperworld.com>
parents:
41520
diff
changeset
|
750 | |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
751 | /* set a user-specified config directory */ |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
752 | if (opt_config_dir_arg != NULL) { |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
753 | if (g_path_is_absolute(opt_config_dir_arg)) { |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
754 | purple_util_set_user_dir(opt_config_dir_arg); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
755 | } else { |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
756 | /* Make an absolute (if not canonical) path */ |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
757 | char *cwd = g_get_current_dir(); |
|
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
758 | char *path = g_build_filename(cwd, opt_config_dir_arg, NULL); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
759 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
760 | purple_util_set_user_dir(path); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
761 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
762 | g_free(cwd); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
763 | g_free(path); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
764 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
765 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
766 | |
|
42886
d9d26508be61
Automatically turn on print debugging in debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42873
diff
changeset
|
767 | pidgin_application_setup_debug(PIDGIN_APPLICATION(application)); |
|
41117
6dc7e403f8f2
Initialize Pidgin GLib logging handler earlier
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41106
diff
changeset
|
768 | |
|
41868
e69cbf7921ec
Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents:
41867
diff
changeset
|
769 | if(!purple_core_init(pidgin_ui_new(), &error)) { |
|
42970
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
770 | AdwDialog *dialog = NULL; |
|
41872
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
771 | const char *error_message = "unknown error"; |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
772 | |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
773 | if(error != NULL) { |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
774 | error_message = error->message; |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
775 | } |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
776 | |
|
42970
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
777 | dialog = adw_alert_dialog_new(_("Pidgin 3 failed to initialize"), |
|
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
778 | error_message); |
|
41868
e69cbf7921ec
Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents:
41867
diff
changeset
|
779 | g_clear_error(&error); |
|
41872
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
780 | |
|
42970
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
781 | adw_alert_dialog_add_responses(ADW_ALERT_DIALOG(dialog), |
|
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
782 | "close", _("Close"), NULL); |
|
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
783 | adw_alert_dialog_set_close_response(ADW_ALERT_DIALOG(dialog), |
|
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
784 | "close"); |
|
41872
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
785 | |
|
42970
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
786 | g_signal_connect(dialog, "response", |
|
41872
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
787 | G_CALLBACK(pidgin_application_error_reponse_cb), |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
788 | application); |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
789 | |
|
42970
365a518a6c7b
Fix Adwaita 1.6 deprecations
Markus Fischer <ivanhoe@fiscari.de>
parents:
42958
diff
changeset
|
790 | adw_dialog_present(ADW_DIALOG(dialog), NULL); |
|
41872
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
791 | |
|
b405b4eb38fa
Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents:
41868
diff
changeset
|
792 | return; |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
793 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
794 | |
|
42950
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
795 | pidgin_application_add_debug_notification(PIDGIN_APPLICATION(application)); |
|
58687db710b5
Display a notification directing users to the issue tracker when using debug builds
Gary Kramlich <grim@reaperworld.com>
parents:
42923
diff
changeset
|
796 | |
|
41169
4103b3869912
Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents:
41134
diff
changeset
|
797 | pidgin_application_init_plugins(); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
798 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
799 | /* load plugins we had when we quit */ |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
800 | purple_plugins_load_saved(PIDGIN_PREFS_ROOT "/plugins/loaded"); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
801 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
802 | gtk_window_set_default_icon_name("pidgin"); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
803 | |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
804 | g_clear_pointer(&opt_config_dir_arg, g_free); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
805 | |
|
43009
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
806 | debug_settings = pidgin_debug_get_settings(); |
|
df1a36761198
Port Debug Window to GSettings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42991
diff
changeset
|
807 | if(g_settings_get_boolean(debug_settings, "visible")) { |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
808 | pidgin_debug_window_show(); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
809 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
810 | |
|
42991
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
811 | /* Set the default state for our actions to match our online state. */ |
|
42647
b6c3acaddc83
Replace purple_accounts_restore_statuses with purple_account_manager_set_online
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
812 | manager = purple_account_manager_get_default(); |
|
b6c3acaddc83
Replace purple_accounts_restore_statuses with purple_account_manager_set_online
Gary Kramlich <grim@reaperworld.com>
parents:
42620
diff
changeset
|
813 | |
|
42991
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
814 | if(!opt_nologin) { |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
815 | online = TRUE; |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
816 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
817 | |
|
42991
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
818 | purple_account_manager_set_online(manager, online); |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
819 | |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
820 | n_actions = G_N_ELEMENTS(pidgin_application_online_actions); |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
821 | pidgin_application_actions_set_enabled(PIDGIN_APPLICATION(application), |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
822 | pidgin_application_online_actions, |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
823 | n_actions, |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
824 | online); |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
825 | |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
826 | n_actions = G_N_ELEMENTS(pidgin_application_channel_actions); |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
827 | pidgin_application_actions_set_enabled(PIDGIN_APPLICATION(application), |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
828 | pidgin_application_channel_actions, |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
829 | n_actions, |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
830 | online); |
|
f832a960a8f7
Update Pidgin.Application to use Purple.AccountManager to check online status
Gary Kramlich <grim@reaperworld.com>
parents:
42970
diff
changeset
|
831 | |
|
43222
e0cc9323ffed
Remove GList versions of purple_account_manager_get_{disabled,enabled}
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43219
diff
changeset
|
832 | active_accounts = purple_account_manager_get_enabled(manager); |
|
43219
778ca78c80c9
Port PidginApplication to purple_account_manager_get_enabled_model
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43085
diff
changeset
|
833 | if(g_list_model_get_n_items(active_accounts) == 0) { |
|
41310
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
41307
diff
changeset
|
834 | g_action_group_activate_action(G_ACTION_GROUP(application), |
|
53e4815ef254
Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents:
41307
diff
changeset
|
835 | "manage-accounts", NULL); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
836 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
837 | |
|
41298
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
838 | /* Populate our dynamic menus. */ |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
839 | pidgin_application_populate_dynamic_menus(PIDGIN_APPLICATION(application)); |
|
6d816e02fd76
Create a menu controller that will keep a GMenu in sync with the disabled accounts in libpurple
Gary Kramlich <grim@reaperworld.com>
parents:
41246
diff
changeset
|
840 | |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
841 | /* Connect to the connected and disconnected signals to manage which menus |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
842 | * are active. |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
843 | */ |
|
42512
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
844 | g_signal_connect_object(manager, "account-connected", |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
845 | G_CALLBACK(pidgin_application_connected_cb), |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
846 | application, 0); |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
847 | g_signal_connect_object(manager, "account-disconnected", |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
848 | G_CALLBACK(pidgin_application_disconnected_cb), |
|
0f4010978378
Use the AccountManager's signals to control the sensitivity of the menus
Gary Kramlich <grim@reaperworld.com>
parents:
42508
diff
changeset
|
849 | application, 0); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
850 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
851 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
852 | static void |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
853 | pidgin_application_activate(GApplication *application) { |
|
43079
82415d67612f
Move default window tracking to the application
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43009
diff
changeset
|
854 | static GtkWidget *default_window = NULL; |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
855 | |
|
43079
82415d67612f
Move default window tracking to the application
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43009
diff
changeset
|
856 | if(!GTK_IS_WIDGET(default_window)) { |
|
43080
dd2d26e6c6f9
Set the application on all windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43079
diff
changeset
|
857 | default_window = pidgin_display_window_new(GTK_APPLICATION(application)); |
|
43079
82415d67612f
Move default window tracking to the application
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43009
diff
changeset
|
858 | g_object_add_weak_pointer(G_OBJECT(default_window), |
|
82415d67612f
Move default window tracking to the application
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43009
diff
changeset
|
859 | (gpointer)&default_window); |
|
82415d67612f
Move default window tracking to the application
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43009
diff
changeset
|
860 | } |
|
82415d67612f
Move default window tracking to the application
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43009
diff
changeset
|
861 | |
|
82415d67612f
Move default window tracking to the application
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43009
diff
changeset
|
862 | if(GTK_IS_WINDOW(default_window)) { |
|
82415d67612f
Move default window tracking to the application
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
43009
diff
changeset
|
863 | gtk_window_present(GTK_WINDOW(default_window)); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
864 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
865 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
866 | |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
867 | static int |
|
41947
7b3312d0760c
Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41932
diff
changeset
|
868 | pidgin_application_handle_local_options(G_GNUC_UNUSED GApplication *application, |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
869 | GVariantDict *options) |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
870 | { |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
871 | if (g_variant_dict_contains(options, "version")) { |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
872 | g_print("%s %s (libpurple %s)\n", PIDGIN_NAME, DISPLAY_VERSION, |
|
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
873 | purple_core_get_version()); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
874 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
875 | return 0; |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
876 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
877 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
878 | return -1; |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
879 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
880 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
881 | /****************************************************************************** |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
882 | * GObject Implementation |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
883 | *****************************************************************************/ |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
884 | static void |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
885 | pidgin_application_dispose(GObject *obj) { |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
886 | PidginApplication *application = PIDGIN_APPLICATION(obj); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
887 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
888 | g_clear_pointer(&application->action_groups, g_hash_table_destroy); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
889 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
890 | G_OBJECT_CLASS(pidgin_application_parent_class)->dispose(obj); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
891 | } |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
892 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
893 | static void |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
894 | pidgin_application_init(PidginApplication *application) { |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
895 | GApplication *gapp = G_APPLICATION(application); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
896 | |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
897 | application->action_groups = g_hash_table_new_full(g_str_hash, g_str_equal, |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
898 | g_free, g_object_unref); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
899 | |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
900 | g_application_add_main_option_entries(gapp, option_entries); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
901 | g_application_add_option_group(gapp, purple_get_option_group()); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
902 | g_application_add_option_group(gapp, gplugin_get_option_group()); |
|
40600
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
903 | |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
904 | g_action_map_add_action_entries(G_ACTION_MAP(application), app_entries, |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
905 | G_N_ELEMENTS(app_entries), application); |
|
46d10c72c137
Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
906 | |
|
42561
998b44b2c5f1
Make the application wide shortcuts work again
Gary Kramlich <grim@reaperworld.com>
parents:
42558
diff
changeset
|
907 | pidgin_application_add_shortcuts(application); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
908 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
909 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
910 | static void |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
911 | pidgin_application_class_init(PidginApplicationClass *klass) { |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
912 | GObjectClass *obj_class = G_OBJECT_CLASS(klass); |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
913 | GApplicationClass *app_class = G_APPLICATION_CLASS(klass); |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
914 | GtkApplicationClass *gtk_app_class = GTK_APPLICATION_CLASS(klass); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
915 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
916 | obj_class->dispose = pidgin_application_dispose; |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
917 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
918 | app_class->startup = pidgin_application_startup; |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
919 | app_class->activate = pidgin_application_activate; |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
920 | app_class->handle_local_options = pidgin_application_handle_local_options; |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
921 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
922 | gtk_app_class->window_added = pidgin_application_window_added; |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
923 | } |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
924 | |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
925 | /****************************************************************************** |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
926 | * Public API |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
927 | *****************************************************************************/ |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
928 | GApplication * |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
929 | pidgin_application_new(void) { |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
930 | return g_object_new( |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
931 | PIDGIN_TYPE_APPLICATION, |
|
40607
807f0b114d36
Add an application ID to Pidgin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
40600
diff
changeset
|
932 | "application-id", "im.pidgin.Pidgin3", |
|
42873
429a2aeb803f
Stop trying to handle protocols uris
Gary Kramlich <grim@reaperworld.com>
parents:
42858
diff
changeset
|
933 | "flags", G_APPLICATION_CAN_OVERRIDE_APP_ID, |
|
40553
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
934 | "register-session", TRUE, |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
935 | NULL); |
|
892459990bb7
Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
936 | } |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
937 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
938 | void |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
939 | pidgin_application_add_action_group(PidginApplication *application, |
|
42923
09fb857fb48c
Some random cleanup in Pidgin.Application
Gary Kramlich <grim@reaperworld.com>
parents:
42913
diff
changeset
|
940 | const char *prefix, |
|
41353
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
941 | GActionGroup *action_group) |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
942 | { |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
943 | GList *windows = NULL; |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
944 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
945 | g_return_if_fail(prefix != NULL); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
946 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
947 | if(G_IS_ACTION_GROUP(action_group)) { |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
948 | /* If action_group is valid, we need to create new references to the |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
949 | * prefix and action_group when inserting them into the hash table. |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
950 | */ |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
951 | g_hash_table_insert(application->action_groups, g_strdup(prefix), |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
952 | g_object_ref(action_group)); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
953 | } else { |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
954 | g_hash_table_remove(application->action_groups, prefix); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
955 | } |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
956 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
957 | /* Now walk through the windows and add/remove the action group. */ |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
958 | windows = gtk_application_get_windows(GTK_APPLICATION(application)); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
959 | while(windows != NULL) { |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
960 | GtkWidget *window = GTK_WIDGET(windows->data); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
961 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
962 | gtk_widget_insert_action_group(window, prefix, action_group); |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
963 | |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
964 | windows = windows->next; |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
965 | } |
|
2b364a6512cc
Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents:
41336
diff
changeset
|
966 | } |
|
41748
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
967 | |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
968 | GtkWindow * |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
969 | pidgin_application_get_active_window(PidginApplication *application) { |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
970 | GtkApplication *gtk_application = NULL; |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
971 | GtkWindow *window = NULL; |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
972 | |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
973 | g_return_val_if_fail(PIDGIN_IS_APPLICATION(application), NULL); |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
974 | |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
975 | gtk_application = GTK_APPLICATION(application); |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
976 | |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
977 | window = gtk_application_get_active_window(gtk_application); |
|
43229
c3d06b7a6126
Fix Pidgin.Application.get_active_window to only return Pidgin.DisplayWindows
Gary Kramlich <grim@reaperworld.com>
parents:
43222
diff
changeset
|
978 | if(!PIDGIN_IS_DISPLAY_WINDOW(window)) { |
|
41748
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
979 | GList *windows = NULL; |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
980 | |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
981 | windows = gtk_application_get_windows(gtk_application); |
|
43229
c3d06b7a6126
Fix Pidgin.Application.get_active_window to only return Pidgin.DisplayWindows
Gary Kramlich <grim@reaperworld.com>
parents:
43222
diff
changeset
|
982 | for(GList *l = windows; l != NULL; l = l->next) { |
|
c3d06b7a6126
Fix Pidgin.Application.get_active_window to only return Pidgin.DisplayWindows
Gary Kramlich <grim@reaperworld.com>
parents:
43222
diff
changeset
|
983 | if(PIDGIN_IS_DISPLAY_WINDOW(l->data)) { |
|
c3d06b7a6126
Fix Pidgin.Application.get_active_window to only return Pidgin.DisplayWindows
Gary Kramlich <grim@reaperworld.com>
parents:
43222
diff
changeset
|
984 | window = l->data; |
|
c3d06b7a6126
Fix Pidgin.Application.get_active_window to only return Pidgin.DisplayWindows
Gary Kramlich <grim@reaperworld.com>
parents:
43222
diff
changeset
|
985 | break; |
|
c3d06b7a6126
Fix Pidgin.Application.get_active_window to only return Pidgin.DisplayWindows
Gary Kramlich <grim@reaperworld.com>
parents:
43222
diff
changeset
|
986 | } |
|
41748
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
987 | } |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
988 | } |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
989 | |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
990 | return window; |
|
fb13b6986266
Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents:
41730
diff
changeset
|
991 | } |