pidgin/pidginapplication.c

Sat, 07 Nov 2020 02:21:44 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Sat, 07 Nov 2020 02:21:44 -0600
changeset 40588
abf38be27d21
parent 40555
0bf5825aab0a
child 40600
46d10c72c137
permissions
-rw-r--r--

Rename a few things in Jabber SI xfer to be clearer.

A small followup to the previous review, which I noticed while working on Bonjour's version.

Testing Done:
compile only.

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

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
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
34 #include "pidginapplication.h"
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 #include "gtkaccount.h"
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
37 #include "gtkblist.h"
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38 #include "pidgincore.h"
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 #include "pidgindebug.h"
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 struct _PidginApplication {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 GtkApplication parent;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 };
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 /******************************************************************************
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 * Globals
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 *****************************************************************************/
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 static gchar *opt_config_dir_arg = NULL;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 static gboolean opt_nologin = FALSE;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 static GOptionEntry option_entries[] = {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 "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
54 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
55 }, {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 "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
57 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
58 },
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 "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
61 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
62 }, {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 NULL
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 };
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 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
68
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 /******************************************************************************
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 * GApplication Implementation
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 *****************************************************************************/
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 static void
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 pidgin_application_startup(GApplication *application) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74 GtkCssProvider *provider = NULL;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 GError *error = NULL;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 GList *active_accounts = NULL;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 gchar *search_path = NULL;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 G_APPLICATION_CLASS(pidgin_application_parent_class)->startup(application);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 /* 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
82 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
83 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
84 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
85 } else {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86 /* 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
87 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
88 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
89
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 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
91
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 g_free(cwd);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 g_free(path);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 provider = gtk_css_provider_new();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 search_path = g_build_filename(purple_config_dir(), "gtk-3.0.css", NULL);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 gtk_css_provider_load_from_path(provider, search_path, &error);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 if(error != NULL) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 purple_debug_error("gtk", "Unable to load custom gtk-3.0.css: %s\n",
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 error->message);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 g_clear_error(&error);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 } else {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 GdkScreen *screen = gdk_screen_get_default();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 gtk_style_context_add_provider_for_screen(screen,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 GTK_STYLE_PROVIDER(provider),
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109 GTK_STYLE_PROVIDER_PRIORITY_USER);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 g_free(search_path);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 #ifdef _WIN32
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 winpidgin_init();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 #endif
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 purple_core_set_ui_ops(pidgin_core_get_ui_ops());
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 if(!purple_core_init(PIDGIN_UI)) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 fprintf(stderr,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 _("Initialization of the libpurple core failed. Aborting!\n"
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 "Please report this!\n"));
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 g_abort();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 if(g_getenv("PURPLE_PLUGINS_SKIP")) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 purple_debug_info("gtk",
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 "PURPLE_PLUGINS_SKIP environment variable "
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 "set, skipping normal Pidgin plugin paths");
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 } else {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 search_path = g_build_filename(purple_data_dir(), "plugins", NULL);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 if(!g_file_test(search_path, G_FILE_TEST_IS_DIR)) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 g_mkdir(search_path, S_IRUSR | S_IWUSR | S_IXUSR);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 purple_plugins_add_search_path(search_path);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 g_free(search_path);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 purple_plugins_add_search_path(PIDGIN_LIBDIR);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 purple_plugins_refresh();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 /* 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
147 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
148
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 /* gk 20201008: this needs to be moved to the buddy list initialization. */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 pidgin_blist_setup_sort_methods();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152 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
153
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 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
155 opt_config_dir_arg = NULL;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157 /*
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 * 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
159 * user feels warm and fuzzy.
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 purple_blist_show();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 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
164 pidgin_debug_window_show();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 if(opt_nologin) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 /* Set all accounts to "offline" */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 PurpleSavedStatus *saved_status;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 /* 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
172 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
173 PURPLE_STATUS_OFFLINE, NULL);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 /* 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
176 if(saved_status == NULL) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 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
178 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 /* 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
181 purple_savedstatus_activate(saved_status);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 } else {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 /* 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
184 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
185 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
186 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 purple_accounts_restore_current_statuses();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 if((active_accounts = purple_accounts_get_all_active()) == NULL) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 pidgin_accounts_window_show();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 } else {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 g_list_free(active_accounts);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 /* GTK clears the notification for us when opening the first window, but we
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 * may have launched with only a status icon, so clear it just in case.
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 gdk_notify_startup_complete();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 /* 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
203 g_application_hold(application);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 static void
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 pidgin_application_activate(GApplication *application) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 PidginBuddyList *blist = pidgin_blist_get_default_gtk_blist();
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 if(blist != NULL && blist->window != NULL) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211 gtk_window_present(GTK_WINDOW(blist->window));
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215 static gint
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 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
217 GApplicationCommandLine *cmdline)
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 gchar **argv = NULL;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 gint argc = 0, i = 0;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
221
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 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
223
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
224 if(argc == 1) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
225 /* No arguments, just activate */
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 g_application_activate(application);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 /* 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
230 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
231 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
232 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
233
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
234 g_strfreev(argv);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
236 return 0;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
238
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
239 static gint
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
240 pidgin_application_handle_local_options(GApplication *application,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
241 GVariantDict *options)
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
242 {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
243 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
244 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
245 purple_core_get_version());
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 return 0;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
250 return -1;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
251 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
252
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
253 /******************************************************************************
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 * GObject Implementation
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 *****************************************************************************/
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 static void
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 pidgin_application_init(PidginApplication *application) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 GApplication *gapp = G_APPLICATION(application);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
259
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 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
261 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
262 g_application_add_option_group(gapp, gplugin_get_option_group());
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 static void
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266 pidgin_application_class_init(PidginApplicationClass *klass) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 GApplicationClass *app_class = G_APPLICATION_CLASS(klass);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 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
270 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
271 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
272 app_class->handle_local_options = pidgin_application_handle_local_options;
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 }
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
275 /******************************************************************************
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 * Public API
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 *****************************************************************************/
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 GApplication *
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 pidgin_application_new(void) {
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
280 return g_object_new(
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 PIDGIN_TYPE_APPLICATION,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 "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
283 G_APPLICATION_HANDLES_COMMAND_LINE,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
284 "register-session", TRUE,
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 NULL);
892459990bb7 Create a proper GtkApplication subclass for Pidgin and use it.
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 }

mercurial