Bootstrap the account assistant
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/assistant/pidginaccountassistant.c Tue Jun 08 15:37:38 2021 -0500
@@ -0,0 +1,107 @@
+ * Pidgin - Internet Messenger + * Copyright (C) Pidgin Developers <devel@pidgin.im> + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses/>. +#include "pidginaccountassistant.h" +struct _PidginAccountAssistant { +G_DEFINE_TYPE(PidginAccountAssistant, pidgin_account_assistant, +/****************************************************************************** + *****************************************************************************/ +static GtkWidget *account_assistant = NULL; +/****************************************************************************** + *****************************************************************************/ +pidgin_account_assistant_close(PidginAccountAssistant *assistant) { + gtk_widget_destroy(GTK_WIDGET(assistant)); + /* This should never be false, but just in case some manually creates an + * instance with g_object_new we shouldn't nuke our global instance. + if(account_assistant == GTK_WIDGET(assistant)) { + account_assistant = NULL; +/****************************************************************************** + *****************************************************************************/ +pidgin_account_assistant_cancel_cb(GtkAssistant *assistant, gpointer data) { + pidgin_account_assistant_close(PIDGIN_ACCOUNT_ASSISTANT(assistant)); +pidgin_account_assistant_delete_cb(GtkWidget *widget, GdkEvent *event, + pidgin_account_assistant_close(PIDGIN_ACCOUNT_ASSISTANT(widget)); +/****************************************************************************** + * GObject Implementation + *****************************************************************************/ +pidgin_account_assistant_init(PidginAccountAssistant *assistant) + gtk_widget_init_template(GTK_WIDGET(assistant)); +pidgin_account_assistant_class_init(PidginAccountAssistantClass *klass) + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); + gtk_widget_class_set_template_from_resource( + "/im/pidgin/Pidgin/Assistant/accountassistant.ui" + gtk_widget_class_bind_template_callback(widget_class, + pidgin_account_assistant_delete_cb); + gtk_widget_class_bind_template_callback(widget_class, + pidgin_account_assistant_cancel_cb); +/****************************************************************************** + *****************************************************************************/ +pidgin_account_assistant_show(void) { + if(!PIDGIN_IS_ACCOUNT_ASSISTANT(account_assistant)) { + account_assistant = GTK_WIDGET(g_object_new(PIDGIN_TYPE_ACCOUNT_ASSISTANT, + gtk_widget_show(account_assistant); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/assistant/pidginaccountassistant.h Tue Jun 08 15:37:38 2021 -0500
@@ -0,0 +1,75 @@
+ * Pidgin - Internet Messenger + * Copyright (C) Pidgin Developers <devel@pidgin.im> + * Pidgin is the legal property of its developers, whose names are too numerous + * to list here. Please refer to the COPYRIGHT file distributed with this + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <https://www.gnu.org/licenses/>. +#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION) +# error "only <pidgin.h> may be included directly" +#ifndef PIDGIN_ACCOUNT_ASSISTANT_H +#define PIDGIN_ACCOUNT_ASSISTANT_H + * SECTION:pidginaccountassistant + * @section_id: pidgin-pidginaccountassistant + * @short_description: The account assistant + * @title: Account Assistant widget + * #PidginAccountAssistant is a widget that helps users create accounts. + * PIDGIN_TYPE_ACCOUNT_ASSISTANT: + * The standard _get_type macro for #PidginAccountAssistant. +#define PIDGIN_TYPE_ACCOUNT_ASSISTANT (pidgin_account_assistant_get_type()) +G_DECLARE_FINAL_TYPE(PidginAccountAssistant, pidgin_account_assistant, + PIDGIN, ACCOUNT_ASSISTANT, GtkAssistant) + * PidginAccountAssistant: + * A widget that displays a credential provider. + * pidgin_account_assistant_show: + * Displays the account assistant. +void pidgin_account_assistant_show(void); +#endif /* PIDGIN_ACCOUNT_ASSISTANT_H */ --- a/pidgin/meson.build Tue Jun 08 01:45:21 2021 -0500
+++ b/pidgin/meson.build Tue Jun 08 15:37:38 2021 -0500
@@ -1,4 +1,5 @@
+ 'assistant/pidginaccountassistant.c', @@ -69,6 +70,7 @@
+ 'assistant/pidginaccountassistant.h', --- a/pidgin/pidginapplication.c Tue Jun 08 01:45:21 2021 -0500
+++ b/pidgin/pidginapplication.c Tue Jun 08 15:37:38 2021 -0500
@@ -35,6 +35,7 @@
#include "pidginapplication.h"
+#include "assistant/pidginaccountassistant.h" @@ -176,6 +177,13 @@
+pidgin_application_account_assistant(GSimpleAction *simple, GVariant *parameter, + pidgin_account_assistant_show(); pidgin_application_add_chat(GSimpleAction *simple, GVariant *parameter,
@@ -310,6 +318,9 @@
.activate = pidgin_application_add_buddy,
+ .name = "account-assistant", + .activate = pidgin_application_account_assistant, .activate = pidgin_application_add_chat,
--- a/pidgin/resources/Accounts/menu.ui Tue Jun 08 01:45:21 2021 -0500
+++ b/pidgin/resources/Accounts/menu.ui Tue Jun 08 15:37:38 2021 -0500
@@ -40,18 +40,21 @@
+ <object class="GtkMenuItem"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="action-name">app.account-assistant</property> + <property name="label" translatable="yes">Account Assistant</property> + <property name="use-underline">True</property> <object class="GtkMenuItem" id="enable_account">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">_Enable Account</property>
<property name="use-underline">True</property>
- <object class="GtkMenu" id="disabled_menu">
- <property name="visible">True</property>
- <property name="can-focus">False</property>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/Assistant/accountassistant.ui Tue Jun 08 15:37:38 2021 -0500
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.38.2 --> + <requires lib="gtk+" version="3.24"/> + <template class="PidginAccountAssistant" parent="GtkAssistant"> + <property name="can-focus">False</property> + <signal name="cancel" handler="pidgin_account_assistant_cancel_cb" swapped="no"/> + <signal name="delete-event" handler="pidgin_account_assistant_delete_cb" swapped="no"/> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes">Introduction page</property> + <property name="page-type">intro</property> + <property name="has-padding">False</property> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes">Content page</property> + <property name="has-padding">False</property> + <object class="GtkLabel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes">Confirmation page</property> + <property name="page-type">confirm</property> + <property name="has-padding">False</property> + <child internal-child="action_area"> + <object class="GtkBox"> + <property name="can-focus">False</property> + <property name="halign">end</property> + <property name="margin-left">6</property> + <property name="margin-right">6</property> + <property name="margin-start">6</property> + <property name="margin-end">6</property> + <property name="margin-top">6</property> + <property name="margin-bottom">6</property> + <property name="spacing">6</property> + <property name="has-padding">False</property> --- a/pidgin/resources/pidgin.gresource.xml Tue Jun 08 01:45:21 2021 -0500
+++ b/pidgin/resources/pidgin.gresource.xml Tue Jun 08 15:37:38 2021 -0500
@@ -9,6 +9,7 @@
<file compressed="true">Accounts/chooser.ui</file>
<file compressed="true">Accounts/entry.css</file>
<file compressed="true">Accounts/menu.ui</file>
+ <file compressed="true">Assistant/accountassistant.ui</file> <file compressed="true">Avatar/avatar.ui</file>
<file compressed="true">Avatar/menu.ui</file>
<file compressed="true">BuddyList/window.ui</file>