pidgin/pidginapplication.c

Tue, 17 Oct 2023 02:44:24 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 17 Oct 2023 02:44:24 -0500
changeset 42361
59f54c17c61f
parent 42291
a86b7bcbb471
child 42362
12026692ce99
permissions
-rw-r--r--

Make PidginApplication subclass AdwApplication

This gives us access to the AdwStyleManager which we'll want eventually and
removes a manual call to adw_init.

Testing Done:
Open the application and made sure it started fine.

Reviewed at https://reviews.imfreedom.org/r/2654/

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
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 #ifdef HAVE_CONFIG_H
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 # include <config.h>
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #endif
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include <glib.h>
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #include <glib/gi18n-lib.h>
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 #include <glib/gstdio.h>
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 #include <gplugin.h>
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 #include <purple.h>
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33
41520
a5dd595361b4 Replace libhandy with libadwaita
Gary Kramlich <grim@reaperworld.com>
parents: 41479
diff changeset
34 #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
35
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 #include "pidginapplication.h"
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 #include "gtkblist.h"
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
39 #include "gtkdialogs.h"
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
40 #include "gtkroomlist.h"
41320
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
41 #include "gtksavedstatuses.h"
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
42 #include "gtkxfer.h"
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
43 #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
44 #include "pidginaccounteditor.h"
41310
53e4815ef254 Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents: 41307
diff changeset
45 #include "pidginaccountmanager.h"
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41441
diff changeset
46 #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
47 #include "pidginaccountsenabledmenu.h"
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 #include "pidgincore.h"
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 #include "pidgindebug.h"
41702
4289b30044ed Rename pidginconversationwindow.[ch] to pidgindisplaywindow.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 41696
diff changeset
50 #include "pidgindisplaywindow.h"
41320
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
51 #include "pidginpluginsdialog.h"
41414
b76bc2b4d7cc Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
52 #include "pidginpluginsmenu.h"
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41853
diff changeset
53 #include "pidginprefs.h"
41416
253e831b0a1e Remove the manager, editor, and substatus editor from gtksavedstatuses
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
54 #include "pidginstatuseditor.h"
41320
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
55 #include "pidginstatusmanager.h"
41867
5375c1d58c50 Create PurpleUi that merges PurpleCoreUiOps and PurpleUiInfo
Gary Kramlich <grim@reaperworld.com>
parents: 41853
diff changeset
56 #include "pidginui.h"
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 struct _PidginApplication {
42361
59f54c17c61f Make PidginApplication subclass AdwApplication
Gary Kramlich <grim@reaperworld.com>
parents: 42291
diff changeset
59 AdwApplication parent;
41353
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
60
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
61 GHashTable *action_groups;
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 };
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 /******************************************************************************
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65 * Globals
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 *****************************************************************************/
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67 static gchar *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
68 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
69 static gboolean opt_nologin = FALSE;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 static GOptionEntry option_entries[] = {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 "config", 'c', 0, G_OPTION_ARG_FILENAME, &opt_config_dir_arg,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 N_("use DIR for config files"), N_("DIR")
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 }, {
41336
844484fb31aa The debug command line option does not actually take an argument.
Stu Tomlinson <stu@nosnilmot.com>
parents: 41320
diff changeset
76 "debug", 'd', 0, G_OPTION_ARG_NONE, &opt_debug,
41127
cd297cfc56f3 Move debug command-line option to the UIs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41117
diff changeset
77 N_("print debugging messages to stdout"), NULL
cd297cfc56f3 Move debug command-line option to the UIs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41117
diff changeset
78 }, {
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 "nologin", 'n', 0, G_OPTION_ARG_NONE, &opt_nologin,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 N_("don't automatically login"), NULL
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 },
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 "version", 'v', 0, G_OPTION_ARG_NONE, NULL,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 N_("display the current version and exit"), NULL
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 }, {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 NULL
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88 };
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 G_DEFINE_TYPE(PidginApplication, pidgin_application, GTK_TYPE_APPLICATION)
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 /******************************************************************************
41169
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
93 * Helpers
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
94 *****************************************************************************/
41634
f73f2b9c75b4 Do our best to set a transient parent for all of our dialogs
Gary Kramlich <grim@reaperworld.com>
parents: 41630
diff changeset
95
f73f2b9c75b4 Do our best to set a transient parent for all of our dialogs
Gary Kramlich <grim@reaperworld.com>
parents: 41630
diff changeset
96 /*
42151
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
97 * pidgin_application_get_account_manager:
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
98 *
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
99 * 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
100 * helper manages the singleton.
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 * Since: 3.0.0
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
103 */
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
104 static GtkWidget *
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
105 pidgin_application_get_account_manager(void) {
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
106 static GtkWidget *manager = NULL;
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
107
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
108 if(!PIDGIN_IS_ACCOUNT_MANAGER(manager)) {
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
109 manager = pidgin_account_manager_new();
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
110 g_object_add_weak_pointer(G_OBJECT(manager), (gpointer)&manager);
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
111 }
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
112
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
113 return 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 /*
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
117 * 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
118 * @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
119 * @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
120 *
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 * 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
122 * 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
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 * Since: 3.0.0
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 */
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 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
127 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
128 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
129 {
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 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
131
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 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
133 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
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 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
136
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 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
138
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 gtk_window_present_with_time(window, GDK_CURRENT_TIME);
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 }
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
41651
eba22f6af173 Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41634
diff changeset
142 static void
eba22f6af173 Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41634
diff changeset
143 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
144 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
145 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
146 {
eba22f6af173 Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41634
diff changeset
147 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
148 }
eba22f6af173 Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41634
diff changeset
149
41169
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
150 static void
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
151 pidgin_application_init_plugins(void) {
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
152 GPluginManager *manager = gplugin_manager_get_default();
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
153
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
154 gplugin_manager_append_paths_from_environment(manager,
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
155 "PIDGIN_PLUGIN_PATH");
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 if(g_getenv("PURPLE_PLUGINS_SKIP")) {
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
158 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
159 "normal Pidgin plugin paths");
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
160 } else {
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
161 gchar *path = g_build_filename(purple_data_dir(), "plugins", NULL);
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
162
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
163 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
164 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
165 }
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
166
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
167 gplugin_manager_append_path(manager, path);
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
168 g_free(path);
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, PIDGIN_LIBDIR);
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
171 }
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
172
41651
eba22f6af173 Save loaded plugin state when they are loaded/unloaded
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41634
diff changeset
173 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
174 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
175 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
176 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
177 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
178 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
179 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
180 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
181
41169
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
182 purple_plugins_refresh();
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
183 }
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
184
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
185 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
186 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
187 GMenu *target = NULL;
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
188 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
189
41450
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41441
diff changeset
190 /* Link the AccountsDisabledMenu into its proper location. */
ce81f2bc04ca Rename PidginInactiveAccountsMenu to PidginAccountsDisabledMenu to match PidginAccountsEnabledMenu
Gary Kramlich <grim@reaperworld.com>
parents: 41441
diff changeset
191 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
192 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
193 "disabled-accounts");
41315
1c9f47bbc031 Replace PidginAccountsDisabledMenu with PidginInactiveAccountsMenu which is a GMenuModel subclass.
Gary Kramlich <grim@reaperworld.com>
parents: 41314
diff changeset
194 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
195
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
196 /* 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
197 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
198 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
199 "enabled-accounts");
41457
f0e7534a555d Convert PidginAccountsEnabledMenu from a menu controller to a GMenuModel
Gary Kramlich <grim@reaperworld.com>
parents: 41454
diff changeset
200 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
201
b76bc2b4d7cc Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
202 /* Link the PluginsMenu into its proper location. */
b76bc2b4d7cc Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
203 model = pidgin_plugins_menu_new();
b76bc2b4d7cc Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
204 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
205 "plugins-menu");
b76bc2b4d7cc Convert plugin actions to GMenu and GAction
Gary Kramlich <grim@reaperworld.com>
parents: 41396
diff changeset
206 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
207 }
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
208
41169
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
209 /******************************************************************************
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
210 * Actions
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
211 *****************************************************************************/
41479
3d2e114380f6 Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41457
diff changeset
212 /*< private >
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
213 * pidgin_application_online_actions:
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
214 *
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
215 * 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
216 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
217 static const gchar *pidgin_application_online_actions[] = {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
218 "add-buddy",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
219 "add-group",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
220 "get-user-info",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
221 "new-message",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
222 };
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
223
41479
3d2e114380f6 Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41457
diff changeset
224 /*< private >
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
225 * pidgin_application_chat_actions:
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
226 *
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
227 * This list keeps track of which actions should only be enabled if a protocol
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
228 * supporting groups chats is connected.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
229 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
230 static const gchar *pidgin_application_chat_actions[] = {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
231 "add-chat",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
232 "join-chat",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
233 };
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
234
41479
3d2e114380f6 Add source files to GObject introspection
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41457
diff changeset
235 /*< private >
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
236 * pidgin_application_room_list_actions:
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
237 *
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
238 * This list keeps track of which actions should only be enabled if an online
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
239 * account supports room lists.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
240 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
241 static const gchar *pidgin_application_room_list_actions[] = {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
242 "room-list",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
243 };
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
244
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
245 /*< private >
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
246 * pidgin_action_group_actions_set_enable:
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
247 * @group: The #PidginActionGroup instance.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
248 * @actions: The action names.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
249 * @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
250 * @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
251 *
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
252 * 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
253 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
254 static void
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
255 pidgin_application_actions_set_enabled(PidginApplication *application,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
256 const gchar *const *actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
257 gint n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
258 gboolean enabled)
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
259 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
260 gint i = 0;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
261
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
262 for(i = 0; i < n_actions; i++) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
263 GAction *action = NULL;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
264 const gchar *name = actions[i];
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
265
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
266 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
267
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
268 if(action != NULL) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
269 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
270 } else {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
271 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
272 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
273 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
274 }
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 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
277 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
278 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
279 {
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
280 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
281 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
282
41307
685bab46fad2 Move the singleton handling of the about dialog to the action handler.
Gary Kramlich <grim@reaperworld.com>
parents: 41306
diff changeset
283 if(!GTK_IS_WIDGET(about)) {
685bab46fad2 Move the singleton handling of the about dialog to the action handler.
Gary Kramlich <grim@reaperworld.com>
parents: 41306
diff changeset
284 about = pidgin_about_dialog_new();
685bab46fad2 Move the singleton handling of the about dialog to the action handler.
Gary Kramlich <grim@reaperworld.com>
parents: 41306
diff changeset
285 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
286 }
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
287
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
288 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
289 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
290
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
291 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
292 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
293 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
294 {
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
295 PidginApplication *application = data;
42151
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
296 GtkWidget *manager = pidgin_application_get_account_manager();
41310
53e4815ef254 Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents: 41307
diff changeset
297
42151
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
298 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
299
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
300 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
301 GTK_WINDOW(manager));
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
302 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
303
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
304 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
305 pidgin_application_add_buddy(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
306 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
307 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
308 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
309 purple_blist_request_add_buddy(NULL, NULL, NULL, NULL);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
310 }
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 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
313 pidgin_application_add_chat(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
314 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
315 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
316 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
317 purple_blist_request_add_chat(NULL, NULL, NULL, NULL);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
318 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
319
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
320 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
321 pidgin_application_add_group(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
322 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
323 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
324 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
325 purple_blist_request_add_group();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
326 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
327
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
328 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
329 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
330 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
331 G_GNUC_UNUSED gpointer data)
41441
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
332 {
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
333 PurpleAccount *account = NULL;
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
334 PurpleAccountManager *manager = NULL;
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
335 const gchar *id = 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 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
338
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
339 manager = purple_account_manager_get_default();
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
340
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
341 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
342 if(PURPLE_IS_ACCOUNT(account)) {
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
343 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
344 g_clear_object(&account);
41441
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 }
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
347
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
348 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
349 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
350 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
351 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
352 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
353 gboolean old = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled");
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
354 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/enabled", !old);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
355 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
356
41304
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
357
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
358 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
359 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
360 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
361 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
362 {
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
363 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
364 PurpleAccountManager *manager = NULL;
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
365 const gchar *id = 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
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
367 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
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 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
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 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
372 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
373 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
374 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
375 }
42291
a86b7bcbb471 Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents: 42163
diff changeset
376
a86b7bcbb471 Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents: 42163
diff changeset
377 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
378 }
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
379 }
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 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
382 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
383 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
384 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
385 {
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 purple_notify_uri(NULL, "https://www.imfreedom.org/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
387 }
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
388
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
389 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
390 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
391 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
392 {
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
393 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
394 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
395 PurpleAccountManager *manager = NULL;
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
396 const gchar *id = NULL;
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
397
42151
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
398 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
399 g_warning("parameter is of type %s, expected %s",
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
400 g_variant_get_type_string(parameter),
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
401 (char *)G_VARIANT_TYPE_STRING);
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
402
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
403 return;
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
404 }
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
405
41304
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
406 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
407
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
408 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
409
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
410 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
411 if(PURPLE_IS_ACCOUNT(account)) {
42151
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
412 GtkWidget *account_manager = pidgin_application_get_account_manager();
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
413
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
414 pidgin_account_manager_edit_account(PIDGIN_ACCOUNT_MANAGER(account_manager),
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
415 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
416
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
417 pidgin_application_present_transient_window(application,
42151
41b9c5be8965 Embed PidginAccountEditor into PidginAccountManager
Gary Kramlich <grim@reaperworld.com>
parents: 42072
diff changeset
418 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
419
a86b7bcbb471 Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents: 42163
diff changeset
420 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
421 }
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
422 }
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
423
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
424 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
425 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
426 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
427 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
428 {
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
429 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
430 PurpleAccountManager *manager = 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
431 const gchar *id = 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
432
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
433 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
434
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
435 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
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 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
438 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
439 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
440 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
441 }
42291
a86b7bcbb471 Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents: 42163
diff changeset
442
a86b7bcbb471 Make the purple_account_manager_find functions return transfer full.
Gary Kramlich <grim@reaperworld.com>
parents: 42163
diff changeset
443 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
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 }
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
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
447 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
448 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
449 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
450 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
451 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
452 pidgin_xfer_dialog_show(NULL);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
453 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
454
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
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_get_user_info(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 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
460 pidgin_dialogs_info();
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
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
464 pidgin_application_join_chat(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
465 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
466 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
467 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
468 pidgin_blist_joinchat_show();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
469 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
470
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
471 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
472 pidgin_application_new_message(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
473 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
474 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
475 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
476 pidgin_dialogs_im();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
477 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
478
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
479 static void
41320
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
480 pidgin_application_new_status(G_GNUC_UNUSED GSimpleAction *simple,
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
481 G_GNUC_UNUSED GVariant *parameter,
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
482 G_GNUC_UNUSED gpointer data)
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
483 {
41416
253e831b0a1e Remove the manager, editor, and substatus editor from gtksavedstatuses
Gary Kramlich <grim@reaperworld.com>
parents: 41414
diff changeset
484 GtkWidget *editor = pidgin_status_editor_new(NULL);
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
485 gtk_window_present_with_time(GTK_WINDOW(editor), GDK_CURRENT_TIME);
41320
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
486 }
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
487
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
488 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
489 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
490 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
491 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
492 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
493 purple_notify_uri(NULL, PURPLE_WEBSITE "help");
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
494 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
495
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
496 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
497 pidgin_application_plugins(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
498 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
499 {
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
500 PidginApplication *application = data;
41630
8942038c4887 Make Plugin window a singleton
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41583
diff changeset
501 static GtkWidget *dialog = NULL;
8942038c4887 Make Plugin window a singleton
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41583
diff changeset
502
8942038c4887 Make Plugin window a singleton
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41583
diff changeset
503 if(!GTK_IS_WIDGET(dialog)) {
8942038c4887 Make Plugin window a singleton
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41583
diff changeset
504 dialog = pidgin_plugins_dialog_new();
8942038c4887 Make Plugin window a singleton
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41583
diff changeset
505 g_object_add_weak_pointer(G_OBJECT(dialog), (gpointer)&dialog);
8942038c4887 Make Plugin window a singleton
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41583
diff changeset
506 }
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
507
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
508 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
509 GTK_WINDOW(dialog));
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_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
514 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
515 gpointer data)
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
516 {
42072
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
517 PidginApplication *application = data;
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
518 static GtkWidget *preferences = NULL;
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
519
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
520 if(!GTK_IS_WIDGET(preferences)) {
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
521 preferences = g_object_new(PIDGIN_TYPE_PREFS_WINDOW, NULL);
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
522 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
523 }
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
524
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
525 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
526 GTK_WINDOW(preferences));
606edc665dc2 Display the preferences window as a singleton from the application
Gary Kramlich <grim@reaperworld.com>
parents: 42061
diff changeset
527
40600
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 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
531 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
532 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
533 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
534 {
41853
d5fe1ee0efae Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents: 41748
diff changeset
535 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
536
d5fe1ee0efae Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents: 41748
diff changeset
537 /* 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
538 * update preferences.
d5fe1ee0efae Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents: 41748
diff changeset
539 */
d5fe1ee0efae Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents: 41748
diff changeset
540 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
541 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
542 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
543 NULL);
d5fe1ee0efae Disconnect the plugin state signals before we tell the core to shutdown
Gary Kramlich <grim@reaperworld.com>
parents: 41748
diff changeset
544
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
545 purple_core_quit();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
546 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
547
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
548 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
549 pidgin_application_room_list(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
550 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
551 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
552 {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
553 pidgin_roomlist_dialog_show();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
554 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
555
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
556 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
557 pidgin_application_show_status_manager(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
558 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
559 gpointer data)
41234
293ee44d15a7 Add a statuses item to the tools menu that opens the status manager
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
560 {
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
561 PidginApplication *application = data;
41306
8befd71928c2 Create a new status manager that's built in glade
Gary Kramlich <grim@reaperworld.com>
parents: 41304
diff changeset
562 static GtkWidget *manager = NULL;
8befd71928c2 Create a new status manager that's built in glade
Gary Kramlich <grim@reaperworld.com>
parents: 41304
diff changeset
563
8befd71928c2 Create a new status manager that's built in glade
Gary Kramlich <grim@reaperworld.com>
parents: 41304
diff changeset
564 if(!GTK_IS_WIDGET(manager)) {
8befd71928c2 Create a new status manager that's built in glade
Gary Kramlich <grim@reaperworld.com>
parents: 41304
diff changeset
565 manager = pidgin_status_manager_new();
8befd71928c2 Create a new status manager that's built in glade
Gary Kramlich <grim@reaperworld.com>
parents: 41304
diff changeset
566 g_object_add_weak_pointer(G_OBJECT(manager), (gpointer)&manager);
8befd71928c2 Create a new status manager that's built in glade
Gary Kramlich <grim@reaperworld.com>
parents: 41304
diff changeset
567 }
8befd71928c2 Create a new status manager that's built in glade
Gary Kramlich <grim@reaperworld.com>
parents: 41304
diff changeset
568
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
569 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
570 GTK_WINDOW(manager));
41234
293ee44d15a7 Add a statuses item to the tools menu that opens the status manager
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
571 }
293ee44d15a7 Add a statuses item to the tools menu that opens the status manager
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
572
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
573 static GActionEntry app_entries[] = {
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 .name = "about",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
576 .activate = pidgin_application_about,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
577 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
578 .name = "add-buddy",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
579 .activate = pidgin_application_add_buddy,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
580 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
581 .name = "add-chat",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
582 .activate = pidgin_application_add_chat,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
583 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
584 .name = "add-group",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
585 .activate = pidgin_application_add_group,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
586 }, {
41441
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
587 .name = "connect-account",
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
588 .activate = pidgin_application_connect_account,
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
589 .parameter_type = "s",
e114ed471a1e Implement the UI for the new Notifications API.
Gary Kramlich <grim@reaperworld.com>
parents: 41416
diff changeset
590 }, {
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
591 .name = "debug",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
592 .activate = pidgin_application_debug,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
593 }, {
41304
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
594 .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
595 .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
596 .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
597 }, {
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
598 .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
599 .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
600 }, {
41304
25830cad9bfc Add a menu controller for the accounts enabled section of the accounts menu
Gary Kramlich <grim@reaperworld.com>
parents: 41303
diff changeset
601 .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
602 .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
603 .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
604 }, {
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
605 .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
606 .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
607 .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
608 }, {
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
609 .name = "file-transfers",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
610 .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
611 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
612 .name = "get-user-info",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
613 .activate = pidgin_application_get_user_info,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
614 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
615 .name = "join-chat",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
616 .activate = pidgin_application_join_chat,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
617 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
618 .name = "manage-accounts",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
619 .activate = pidgin_application_accounts,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
620 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
621 .name = "manage-plugins",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
622 .activate = pidgin_application_plugins,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
623 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
624 .name = "new-message",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
625 .activate = pidgin_application_new_message,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
626 }, {
41320
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
627 .name = "new-status",
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
628 .activate = pidgin_application_new_status,
1695e758b590 Overhaul the status box
Gary Kramlich <grim@reaperworld.com>
parents: 41315
diff changeset
629 }, {
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
630 .name = "online-help",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
631 .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
632 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
633 .name = "preferences",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
634 .activate = pidgin_application_preferences,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
635 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
636 .name = "quit",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
637 .activate = pidgin_application_quit,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
638 }, {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
639 .name = "room-list",
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
640 .activate = pidgin_application_room_list,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
641 }, {
41234
293ee44d15a7 Add a statuses item to the tools menu that opens the status manager
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
642 .name = "status-manager",
293ee44d15a7 Add a statuses item to the tools menu that opens the status manager
Gary Kramlich <grim@reaperworld.com>
parents: 41209
diff changeset
643 .activate = pidgin_application_show_status_manager,
40600
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 };
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
646
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
647 /******************************************************************************
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
648 * Purple Signal Callbacks
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
649 *****************************************************************************/
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
650 static void
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
651 pidgin_application_online_cb(gpointer data) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
652 gint n_actions = G_N_ELEMENTS(pidgin_application_online_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
653
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
654 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
655 pidgin_application_online_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
656 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
657 TRUE);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
658 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
659
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
660 static void
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
661 pidgin_application_offline_cb(gpointer data) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
662 gint n_actions = G_N_ELEMENTS(pidgin_application_online_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
663
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
664 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
665 pidgin_application_online_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
666 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
667 FALSE);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
668 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
669
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
670 static void
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
671 pidgin_application_signed_on_cb(PurpleAccount *account, gpointer data) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
672 PidginApplication *application = PIDGIN_APPLICATION(data);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
673 PurpleProtocol *protocol = NULL;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
674 gboolean should_enable_chat = FALSE, should_enable_room_list = FALSE;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
675 gint n_actions = 0;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
676
40803
0e11ce1049b2 Port Pidgin from purple_protocols to PurpleProtocolManager
Gary Kramlich <grim@reaperworld.com>
parents: 40683
diff changeset
677 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
678
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
679 /* We assume that the current state is correct, so we don't bother changing
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
680 * state unless the newly connected account implements the chat interface,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
681 * which would cause a state change.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
682 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
683 should_enable_chat = PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, info);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
684 if(should_enable_chat) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
685 n_actions = G_N_ELEMENTS(pidgin_application_chat_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
686 pidgin_application_actions_set_enabled(application,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
687 pidgin_application_chat_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
688 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
689 TRUE);
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
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
692 /* likewise, for the room list, we only care about enabling in this
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
693 * handler.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
694 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
695 should_enable_room_list = PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
696 get_list);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
697 if(should_enable_room_list) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
698 n_actions = G_N_ELEMENTS(pidgin_application_room_list_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
699 pidgin_application_actions_set_enabled(application,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
700 pidgin_application_room_list_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
701 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
702 TRUE);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
703 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
704 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
705
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
706 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
707 pidgin_application_signed_off_cb(G_GNUC_UNUSED PurpleAccount *account,
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41932
diff changeset
708 gpointer data)
7b3312d0760c Bump C standard to C99 for Pidgin files and fix warnings
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41932
diff changeset
709 {
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
710 PidginApplication *application = PIDGIN_APPLICATION(data);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
711 gboolean should_disable_chat = TRUE, should_disable_room_list = TRUE;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
712 GList *connections = NULL, *l = NULL;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
713 gint n_actions = 0;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
714
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
715 /* walk through all the connections, looking for online ones that implement
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
716 * the chat interface. We don't bother checking the account that this
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
717 * signal was emitted for, because it's already offline and will be
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
718 * filtered out by the online check.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
719 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
720 connections = purple_connections_get_all();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
721 for(l = connections; l != NULL; l = l->next) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
722 PurpleConnection *connection = PURPLE_CONNECTION(l->data);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
723 PurpleProtocol *protocol = NULL;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
724
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
725 /* if the connection isn't online, we don't care about it */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
726 if(!PURPLE_CONNECTION_IS_CONNECTED(connection)) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
727 continue;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
728 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
729
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
730 protocol = purple_connection_get_protocol(connection);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
731
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
732 /* check if the protocol implements the chat interface */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
733 if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, info)) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
734 should_disable_chat = FALSE;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
735 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
736
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
737 /* check if the protocol implements the room list interface */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
738 if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, ROOMLIST, get_list)) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
739 should_disable_room_list = FALSE;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
740 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
741
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
742 /* if we can't disable both, we can bail out of the loop */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
743 if(!should_disable_chat && !should_disable_room_list) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
744 break;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
745 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
746 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
747
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
748 if(should_disable_chat) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
749 n_actions = G_N_ELEMENTS(pidgin_application_chat_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
750 pidgin_application_actions_set_enabled(application,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
751 pidgin_application_chat_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
752 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
753 FALSE);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
754 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
755
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
756 if(should_disable_room_list) {
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
757 n_actions = G_N_ELEMENTS(pidgin_application_room_list_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
758 pidgin_application_actions_set_enabled(application,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
759 pidgin_application_room_list_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
760 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
761 FALSE);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
762 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
763 }
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
764
41872
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
765 static void
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
766 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
767 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
768 gpointer data)
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
769 {
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
770 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
771 }
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
772
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
773 /******************************************************************************
41353
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
774 * GtkApplication Implementation
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
775 *****************************************************************************/
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
776 static void
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
777 pidgin_application_window_added(GtkApplication *application,
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
778 GtkWindow *window)
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
779 {
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
780 PidginApplication *pidgin_application = PIDGIN_APPLICATION(application);
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
781 GHashTableIter iter;
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
782 gpointer key, value;
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
783
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
784 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
785 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
786
41695
6032b86cb76b Add devel CSS to application windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41689
diff changeset
787 if(strstr(VERSION, "-devel")) {
6032b86cb76b Add devel CSS to application windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41689
diff changeset
788 gtk_widget_add_css_class(GTK_WIDGET(window), "devel");
6032b86cb76b Add devel CSS to application windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41689
diff changeset
789 }
6032b86cb76b Add devel CSS to application windows
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41689
diff changeset
790
41353
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
791 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
792 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
793 GActionGroup *action_group = value;
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
794 gchar *prefix = key;
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
795
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
796 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
797 action_group);
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
798 }
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
799 }
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
800
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
801 /******************************************************************************
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
802 * GApplication Implementation
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
803 *****************************************************************************/
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
804 static void
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
805 pidgin_application_startup(GApplication *application) {
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41169
diff changeset
806 PurpleAccountManager *manager = NULL;
41868
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
807 GError *error = NULL;
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
808 GList *active_accounts = NULL;
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
809 gpointer handle = NULL;
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
810
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
811 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
812
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
813 /* 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
814 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
815 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
816 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
817 } else {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
818 /* Make an absolute (if not canonical) path */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
819 gchar *cwd = g_get_current_dir();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
820 gchar *path = g_build_filename(cwd, opt_config_dir_arg, NULL);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
821
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
822 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
823
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
824 g_free(cwd);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
825 g_free(path);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
826 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
827 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
828
41117
6dc7e403f8f2 Initialize Pidgin GLib logging handler earlier
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41106
diff changeset
829 pidgin_debug_init_handler();
41127
cd297cfc56f3 Move debug command-line option to the UIs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41117
diff changeset
830 #ifdef DEBUG
cd297cfc56f3 Move debug command-line option to the UIs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41117
diff changeset
831 pidgin_debug_set_print_enabled(TRUE);
41336
844484fb31aa The debug command line option does not actually take an argument.
Stu Tomlinson <stu@nosnilmot.com>
parents: 41320
diff changeset
832 #else
844484fb31aa The debug command line option does not actually take an argument.
Stu Tomlinson <stu@nosnilmot.com>
parents: 41320
diff changeset
833 pidgin_debug_set_print_enabled(opt_debug);
41127
cd297cfc56f3 Move debug command-line option to the UIs
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41117
diff changeset
834 #endif
41117
6dc7e403f8f2 Initialize Pidgin GLib logging handler earlier
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41106
diff changeset
835
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
836 #ifdef _WIN32
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
837 winpidgin_init();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
838 #endif
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
839
41868
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
840 if(!purple_core_init(pidgin_ui_new(), &error)) {
41872
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
841 GtkWidget *message = NULL;
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
842 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
843
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
844 if(error != NULL) {
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
845 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
846 }
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
847
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
848 message = adw_message_dialog_new(NULL,
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
849 _("Pidgin 3 failed to initialize"),
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
850 error_message);
41868
e69cbf7921ec Add an out parameter for an error to purple_core_init
Gary Kramlich <grim@reaperworld.com>
parents: 41867
diff changeset
851 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
852
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
853 adw_message_dialog_add_responses(ADW_MESSAGE_DIALOG(message),
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
854 "close", _("Close"), NULL);
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
855 adw_message_dialog_set_close_response(ADW_MESSAGE_DIALOG(message),
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
856 "close");
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
857
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
858 g_signal_connect(message, "response",
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
859 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
860 application);
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
861
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
862 gtk_window_present_with_time(GTK_WINDOW(message), GDK_CURRENT_TIME);
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
863
b405b4eb38fa Display a dialog in Pidgin if purple_core_init returned FALSE
Gary Kramlich <grim@reaperworld.com>
parents: 41868
diff changeset
864 return;
40553
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
41169
4103b3869912 Upgrade to gplugin 0.37.0
Gary Kramlich <grim@reaperworld.com>
parents: 41134
diff changeset
867 pidgin_application_init_plugins();
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
868
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
869 /* 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
870 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
871
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
872 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
873
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
874 g_free(opt_config_dir_arg);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
875 opt_config_dir_arg = NULL;
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 * We want to show the blist early in the init process so the
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
879 * user feels warm and fuzzy.
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 purple_blist_show();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
882
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
883 if(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/enabled")) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
884 pidgin_debug_window_show();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
885 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
886
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
887 if(opt_nologin) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
888 /* Set all accounts to "offline" */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
889 PurpleSavedStatus *saved_status;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
890
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
891 /* If we've used this type+message before, lookup the transient status */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
892 saved_status = purple_savedstatus_find_transient_by_type_and_message(
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
893 PURPLE_STATUS_OFFLINE, NULL);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
894
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
895 /* If this type+message is unique then create a new transient saved status */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
896 if(saved_status == NULL) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
897 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_OFFLINE);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
898 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
899
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
900 /* Set the status for each account */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
901 purple_savedstatus_activate(saved_status);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
902 } else {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
903 /* Everything is good to go--sign on already */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
904 if (!purple_prefs_get_bool("/purple/savedstatus/startup_current_status")) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
905 purple_savedstatus_activate(purple_savedstatus_get_startup());
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
906 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
907
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
908 purple_accounts_restore_current_statuses();
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
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41169
diff changeset
911 manager = purple_account_manager_get_default();
41454
7cc69bde919d Update pidgin for the purple_account_manager_get_(in)active deprecations
Gary Kramlich <grim@reaperworld.com>
parents: 41450
diff changeset
912 active_accounts = purple_account_manager_get_enabled(manager);
41209
909561f42b1f port Pidgin to the new PurpleAccountManager api
Gary Kramlich <grim@reaperworld.com>
parents: 41169
diff changeset
913 if(active_accounts == NULL) {
41310
53e4815ef254 Create a new PidginAccountManager that replaces the manually built one.
Gary Kramlich <grim@reaperworld.com>
parents: 41307
diff changeset
914 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
915 "manage-accounts", NULL);
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
916 } else {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
917 g_list_free(active_accounts);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
918 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
919
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
920 /* 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
921 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
922
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
923 /* TODO: Use GtkApplicationWindow or add a window instead */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
924 g_application_hold(application);
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
925
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
926 /* connect to the online and offline signals in purple connections. This
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
927 * is used to toggle states of actions that require being online.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
928 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
929 handle = purple_connections_get_handle();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
930 purple_signal_connect(handle, "online", application,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41310
diff changeset
931 G_CALLBACK(pidgin_application_online_cb),
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
932 application);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
933 purple_signal_connect(handle, "offline", application,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41310
diff changeset
934 G_CALLBACK(pidgin_application_offline_cb),
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
935 application);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
936
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
937 /* connect to account-signed-on and account-signed-off to toggle actions
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
938 * that depend on specific interfaces in accounts.
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
939 */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
940 handle = purple_accounts_get_handle();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
941 purple_signal_connect(handle, "account-signed-on", application,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41310
diff changeset
942 G_CALLBACK(pidgin_application_signed_on_cb),
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
943 application);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
944 purple_signal_connect(handle, "account-signed-off", application,
41314
0dc72eacd8bf Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 41310
diff changeset
945 G_CALLBACK(pidgin_application_signed_off_cb),
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
946 application);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
947
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
948 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
949
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
950 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
951 pidgin_application_activate(G_GNUC_UNUSED GApplication *application) {
41696
35f8ce475b21 Rename PidginConversationWindow to PidginDisplayWindow as it holds more than conversations now
Gary Kramlich <grim@reaperworld.com>
parents: 41695
diff changeset
952 GtkWidget *convwin = pidgin_display_window_get_default();
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
953
41246
d2a2cc448987 Stop reaching into the PidginBuddyList struct from other files
Gary Kramlich <grim@reaperworld.com>
parents: 41234
diff changeset
954 if(GTK_IS_WINDOW(convwin)) {
d2a2cc448987 Stop reaching into the PidginBuddyList struct from other files
Gary Kramlich <grim@reaperworld.com>
parents: 41234
diff changeset
955 gtk_window_present(GTK_WINDOW(convwin));
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
956 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
957 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
958
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
959 static gint
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
960 pidgin_application_command_line(GApplication *application,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
961 GApplicationCommandLine *cmdline)
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
962 {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
963 gchar **argv = NULL;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
964 gint argc = 0, i = 0;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
965
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
966 argv = g_application_command_line_get_arguments(cmdline, &argc);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
967
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
968 if(argc == 1) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
969 /* No arguments, just activate */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
970 g_application_activate(application);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
971 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
972
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
973 /* Start at 1 to skip the executable name */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
974 for (i = 1; i < argc; i++) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
975 purple_got_protocol_handler_uri(argv[i]);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
976 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
977
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
978 g_strfreev(argv);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
979
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
980 return 0;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
981 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
982
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
983 static gint
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
984 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
985 GVariantDict *options)
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
986 {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
987 if (g_variant_dict_contains(options, "version")) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
988 printf("%s %s (libpurple %s)\n", PIDGIN_NAME, DISPLAY_VERSION,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
989 purple_core_get_version());
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
990
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
991 return 0;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
992 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
993
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
994 return -1;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
995 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
996
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
997 /******************************************************************************
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
998 * GObject Implementation
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
999 *****************************************************************************/
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1000 static void
41353
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1001 pidgin_application_dispose(GObject *obj) {
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1002 PidginApplication *application = PIDGIN_APPLICATION(obj);
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1003
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1004 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
1005
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1006 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
1007 }
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1008
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1009 static void
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1010 pidgin_application_init(PidginApplication *application) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1011 GApplication *gapp = G_APPLICATION(application);
40600
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1012 gboolean online = FALSE;
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1013 gint n_actions = 0;
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1014
41353
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1015 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
1016 g_free, g_object_unref);
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1017
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1018 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
1019 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
1020 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
1021
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1022 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
1023 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
1024
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1025 /* Set the default state for our actions to match our online state. */
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1026 online = purple_connections_is_online();
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1027
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1028 n_actions = G_N_ELEMENTS(pidgin_application_online_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1029 pidgin_application_actions_set_enabled(application,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1030 pidgin_application_online_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1031 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1032 online);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1033
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1034 n_actions = G_N_ELEMENTS(pidgin_application_chat_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1035 pidgin_application_actions_set_enabled(application,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1036 pidgin_application_chat_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1037 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1038 online);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1039
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1040 n_actions = G_N_ELEMENTS(pidgin_application_room_list_actions);
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1041 pidgin_application_actions_set_enabled(application,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1042 pidgin_application_room_list_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1043 n_actions,
46d10c72c137 Create a new ContactList that will eventually fully replace PidginBuddyList
Gary Kramlich <grim@reaperworld.com>
parents: 40555
diff changeset
1044 online);
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1045 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1046
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1047 static void
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1048 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
1049 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
1050 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
1051 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
1052
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1053 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
1054
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1055 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
1056 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
1057 app_class->command_line = pidgin_application_command_line;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1058 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
1059
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1060 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
1061 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1062
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1063 /******************************************************************************
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1064 * Public API
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1065 *****************************************************************************/
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1066 GApplication *
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1067 pidgin_application_new(void) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1068 return g_object_new(
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1069 PIDGIN_TYPE_APPLICATION,
40607
807f0b114d36 Add an application ID to Pidgin.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents: 40600
diff changeset
1070 "application-id", "im.pidgin.Pidgin3",
40553
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1071 "flags", G_APPLICATION_CAN_OVERRIDE_APP_ID |
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1072 G_APPLICATION_HANDLES_COMMAND_LINE,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1073 "register-session", TRUE,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1074 NULL);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1075 }
41353
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1076
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1077 void
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1078 pidgin_application_add_action_group(PidginApplication *application,
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1079 const gchar *prefix,
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1080 GActionGroup *action_group)
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1081 {
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1082 GList *windows = NULL;
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1083
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1084 g_return_if_fail(prefix != NULL);
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1085
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1086 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
1087 /* 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
1088 * 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
1089 */
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1090 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
1091 g_object_ref(action_group));
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1092 } else {
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1093 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
1094 }
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1095
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1096 /* 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
1097 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
1098 while(windows != NULL) {
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1099 GtkWidget *window = GTK_WIDGET(windows->data);
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1100
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1101 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
1102
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1103 windows = windows->next;
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1104 }
2b364a6512cc Make PidginApplication manage action groups for all windows
Gary Kramlich <grim@reaperworld.com>
parents: 41336
diff changeset
1105 }
41748
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1106
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1107 GtkWindow *
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1108 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
1109 GtkApplication *gtk_application = NULL;
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1110 GtkWindow *window = NULL;
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1111
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1112 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
1113
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1114 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
1115
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1116 window = gtk_application_get_active_window(gtk_application);
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1117 if(!GTK_IS_WINDOW(window)) {
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1118 GList *windows = NULL;
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1119
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1120 windows = gtk_application_get_windows(gtk_application);
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1121 if(windows != NULL) {
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1122 window = windows->data;
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1123 }
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1124 }
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1125
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1126 return window;
fb13b6986266 Make the debug window transient for whatever window created it.
Gary Kramlich <grim@reaperworld.com>
parents: 41730
diff changeset
1127 }

mercurial