pidgin/pidgin

Rename PidginAwayPage to PidginAwayPrefs

2022-05-15, Elliott Sales de Andrade
ea87294eff71
Parents 03b5e6d53fa1
Children e7f3a586b63f
Rename PidginAwayPage to PidginAwayPrefs
--- a/pidgin/meson.build Sun May 15 02:27:58 2022 -0500
+++ b/pidgin/meson.build Sun May 15 02:33:16 2022 -0500
@@ -60,7 +60,7 @@
'pidginstylecontext.c',
'pidgintalkatu.c',
'prefs/pidginprefs.c',
- 'prefs/pidginawaypage.c',
+ 'prefs/pidginawayprefs.c',
'prefs/pidginconversationprefs.c',
'prefs/pidgincredentialproviderrow.c',
'prefs/pidgincredentialspage.c',
@@ -132,7 +132,7 @@
libpidgin_prefs_headers = [
'prefs/pidginprefs.h',
- 'prefs/pidginawaypage.h',
+ 'prefs/pidginawayprefs.h',
'prefs/pidginconversationprefs.h',
'prefs/pidgincredentialproviderrow.h',
'prefs/pidgincredentialspage.h',
--- a/pidgin/prefs/pidginawaypage.c Sun May 15 02:27:58 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * 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
- * source distribution.
- *
- * 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 <purple.h>
-
-#include <handy.h>
-
-#include "pidginawaypage.h"
-#include "gtksavedstatuses.h"
-#include "gtkutils.h"
-#include "pidginprefsinternal.h"
-
-struct _PidginAwayPage {
- HdyPreferencesPage parent;
-
- PidginPrefCombo idle_reporting;
- GtkWidget *mins_before_away;
- GtkWidget *idle_hbox;
- GtkWidget *away_when_idle;
- PidginPrefCombo auto_reply;
- GtkWidget *startup_current_status;
- GtkWidget *startup_hbox;
- GtkWidget *startup_label;
-};
-
-G_DEFINE_TYPE(PidginAwayPage, pidgin_away_page, HDY_TYPE_PREFERENCES_PAGE)
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-static void
-set_idle_away(PurpleSavedStatus *status)
-{
- purple_prefs_set_int("/purple/savedstatus/idleaway",
- purple_savedstatus_get_creation_time(status));
-}
-
-static void
-set_startupstatus(PurpleSavedStatus *status)
-{
- purple_prefs_set_int("/purple/savedstatus/startup",
- purple_savedstatus_get_creation_time(status));
-}
-
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-static void
-pidgin_away_page_class_init(PidginAwayPageClass *klass)
-{
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
-
- gtk_widget_class_set_template_from_resource(
- widget_class,
- "/im/pidgin/Pidgin3/Prefs/away.ui"
- );
-
- gtk_widget_class_bind_template_child(
- widget_class, PidginAwayPage, idle_reporting.combo);
- gtk_widget_class_bind_template_child(
- widget_class, PidginAwayPage, mins_before_away);
- gtk_widget_class_bind_template_child(
- widget_class, PidginAwayPage, away_when_idle);
- gtk_widget_class_bind_template_child(
- widget_class, PidginAwayPage, idle_hbox);
- gtk_widget_class_bind_template_child(
- widget_class, PidginAwayPage, auto_reply.combo);
- gtk_widget_class_bind_template_child(
- widget_class, PidginAwayPage, startup_current_status);
- gtk_widget_class_bind_template_child(
- widget_class, PidginAwayPage, startup_hbox);
- gtk_widget_class_bind_template_child(
- widget_class, PidginAwayPage, startup_label);
-}
-
-static void
-pidgin_away_page_init(PidginAwayPage *page)
-{
- GtkWidget *menu;
-
- gtk_widget_init_template(GTK_WIDGET(page));
-
- page->idle_reporting.type = PURPLE_PREF_STRING;
- page->idle_reporting.key = "/purple/away/idle_reporting";
- pidgin_prefs_bind_dropdown(&page->idle_reporting);
-
- pidgin_prefs_bind_spin_button("/purple/away/mins_before_away",
- page->mins_before_away);
-
- pidgin_prefs_bind_checkbox("/purple/away/away_when_idle",
- page->away_when_idle);
-
- /* TODO: Show something useful if we don't have any saved statuses. */
- menu = pidgin_status_menu(purple_savedstatus_get_idleaway(),
- G_CALLBACK(set_idle_away));
- gtk_widget_show_all(menu);
- gtk_box_pack_start(GTK_BOX(page->idle_hbox), menu, FALSE, FALSE, 0);
-
- g_object_bind_property(page->away_when_idle, "active",
- menu, "sensitive",
- G_BINDING_SYNC_CREATE);
-
- /* Away stuff */
- page->auto_reply.type = PURPLE_PREF_STRING;
- page->auto_reply.key = "/purple/away/auto_reply";
- pidgin_prefs_bind_dropdown(&page->auto_reply);
-
- /* Signon status stuff */
- pidgin_prefs_bind_checkbox("/purple/savedstatus/startup_current_status",
- page->startup_current_status);
-
- /* TODO: Show something useful if we don't have any saved statuses. */
- menu = pidgin_status_menu(purple_savedstatus_get_startup(),
- G_CALLBACK(set_startupstatus));
- gtk_widget_show_all(menu);
- gtk_box_pack_start(GTK_BOX(page->startup_hbox), menu, FALSE, FALSE, 0);
- gtk_label_set_mnemonic_widget(GTK_LABEL(page->startup_label), menu);
- pidgin_set_accessible_label(menu, GTK_LABEL(page->startup_label));
- g_object_bind_property(page->startup_current_status, "active",
- page->startup_hbox, "sensitive",
- G_BINDING_SYNC_CREATE|G_BINDING_INVERT_BOOLEAN);
-}
-
-/******************************************************************************
- * API
- *****************************************************************************/
-GtkWidget *
-pidgin_away_page_new(void) {
- return GTK_WIDGET(g_object_new(PIDGIN_TYPE_AWAY_PAGE, NULL));
-}
--- a/pidgin/prefs/pidginawaypage.h Sun May 15 02:27:58 2022 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * 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
- * source distribution.
- *
- * 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"
-#endif
-
-#ifndef PIDGIN_AWAY_PAGE_H
-#define PIDGIN_AWAY_PAGE_H
-
-#include <glib.h>
-
-#include <gtk/gtk.h>
-#include <handy.h>
-
-G_BEGIN_DECLS
-
-/**
- * PidginAwayPage:
- *
- * #PidginAwayPage is a widget for the preferences window to let users
- * choose and configure their away and idle settings.
- *
- * Since: 3.0.0
- */
-#define PIDGIN_TYPE_AWAY_PAGE (pidgin_away_page_get_type())
-G_DECLARE_FINAL_TYPE(PidginAwayPage, pidgin_away_page,
- PIDGIN, AWAY_PAGE, HdyPreferencesPage)
-
-/**
- * pidgin_away_page_new:
- *
- * Creates a new #PidginAwayPage instance.
- *
- * Returns: (transfer full): The new #PidginAwayPage instance.
- *
- * Since: 3.0.0
- */
-GtkWidget *pidgin_away_page_new(void);
-
-G_END_DECLS
-
-#endif /* PIDGIN_AWAY_PAGE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/prefs/pidginawayprefs.c Sun May 15 02:33:16 2022 -0500
@@ -0,0 +1,149 @@
+/*
+ * 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
+ * source distribution.
+ *
+ * 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 <purple.h>
+
+#include <handy.h>
+
+#include "pidginawayprefs.h"
+#include "gtksavedstatuses.h"
+#include "gtkutils.h"
+#include "pidginprefsinternal.h"
+
+struct _PidginAwayPrefs {
+ HdyPreferencesPage parent;
+
+ PidginPrefCombo idle_reporting;
+ GtkWidget *mins_before_away;
+ GtkWidget *idle_hbox;
+ GtkWidget *away_when_idle;
+ PidginPrefCombo auto_reply;
+ GtkWidget *startup_current_status;
+ GtkWidget *startup_hbox;
+ GtkWidget *startup_label;
+};
+
+G_DEFINE_TYPE(PidginAwayPrefs, pidgin_away_prefs, HDY_TYPE_PREFERENCES_PAGE)
+
+/******************************************************************************
+ * Helpers
+ *****************************************************************************/
+static void
+set_idle_away(PurpleSavedStatus *status)
+{
+ purple_prefs_set_int("/purple/savedstatus/idleaway",
+ purple_savedstatus_get_creation_time(status));
+}
+
+static void
+set_startupstatus(PurpleSavedStatus *status)
+{
+ purple_prefs_set_int("/purple/savedstatus/startup",
+ purple_savedstatus_get_creation_time(status));
+}
+
+/******************************************************************************
+ * GObject Implementation
+ *****************************************************************************/
+static void
+pidgin_away_prefs_class_init(PidginAwayPrefsClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+
+ gtk_widget_class_set_template_from_resource(
+ widget_class,
+ "/im/pidgin/Pidgin3/Prefs/away.ui"
+ );
+
+ gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
+ idle_reporting.combo);
+ gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
+ mins_before_away);
+ gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
+ away_when_idle);
+ gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
+ idle_hbox);
+ gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
+ auto_reply.combo);
+ gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
+ startup_current_status);
+ gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
+ startup_hbox);
+ gtk_widget_class_bind_template_child(widget_class, PidginAwayPrefs,
+ startup_label);
+}
+
+static void
+pidgin_away_prefs_init(PidginAwayPrefs *prefs)
+{
+ GtkWidget *menu;
+
+ gtk_widget_init_template(GTK_WIDGET(prefs));
+
+ prefs->idle_reporting.type = PURPLE_PREF_STRING;
+ prefs->idle_reporting.key = "/purple/away/idle_reporting";
+ pidgin_prefs_bind_dropdown(&prefs->idle_reporting);
+
+ pidgin_prefs_bind_spin_button("/purple/away/mins_before_away",
+ prefs->mins_before_away);
+
+ pidgin_prefs_bind_checkbox("/purple/away/away_when_idle",
+ prefs->away_when_idle);
+
+ /* TODO: Show something useful if we don't have any saved statuses. */
+ menu = pidgin_status_menu(purple_savedstatus_get_idleaway(),
+ G_CALLBACK(set_idle_away));
+ gtk_widget_show_all(menu);
+ gtk_box_pack_start(GTK_BOX(prefs->idle_hbox), menu, FALSE, FALSE, 0);
+
+ g_object_bind_property(prefs->away_when_idle, "active",
+ menu, "sensitive",
+ G_BINDING_SYNC_CREATE);
+
+ /* Away stuff */
+ prefs->auto_reply.type = PURPLE_PREF_STRING;
+ prefs->auto_reply.key = "/purple/away/auto_reply";
+ pidgin_prefs_bind_dropdown(&prefs->auto_reply);
+
+ /* Signon status stuff */
+ pidgin_prefs_bind_checkbox("/purple/savedstatus/startup_current_status",
+ prefs->startup_current_status);
+
+ /* TODO: Show something useful if we don't have any saved statuses. */
+ menu = pidgin_status_menu(purple_savedstatus_get_startup(),
+ G_CALLBACK(set_startupstatus));
+ gtk_widget_show_all(menu);
+ gtk_box_pack_start(GTK_BOX(prefs->startup_hbox), menu, FALSE, FALSE, 0);
+ gtk_label_set_mnemonic_widget(GTK_LABEL(prefs->startup_label), menu);
+ pidgin_set_accessible_label(menu, GTK_LABEL(prefs->startup_label));
+ g_object_bind_property(prefs->startup_current_status, "active",
+ prefs->startup_hbox, "sensitive",
+ G_BINDING_SYNC_CREATE|G_BINDING_INVERT_BOOLEAN);
+}
+
+/******************************************************************************
+ * API
+ *****************************************************************************/
+GtkWidget *
+pidgin_away_prefs_new(void) {
+ return GTK_WIDGET(g_object_new(PIDGIN_TYPE_AWAY_PREFS, NULL));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/prefs/pidginawayprefs.h Sun May 15 02:33:16 2022 -0500
@@ -0,0 +1,62 @@
+/*
+ * 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
+ * source distribution.
+ *
+ * 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"
+#endif
+
+#ifndef PIDGIN_AWAY_PREFS_H
+#define PIDGIN_AWAY_PREFS_H
+
+#include <glib.h>
+
+#include <gtk/gtk.h>
+#include <handy.h>
+
+G_BEGIN_DECLS
+
+/**
+ * PidginAwayPrefs:
+ *
+ * #PidginAwayPrefs is a widget for the preferences window to let users
+ * choose and configure their away and idle settings.
+ *
+ * Since: 3.0.0
+ */
+#define PIDGIN_TYPE_AWAY_PREFS (pidgin_away_prefs_get_type())
+G_DECLARE_FINAL_TYPE(PidginAwayPrefs, pidgin_away_prefs,
+ PIDGIN, AWAY_PREFS, HdyPreferencesPage)
+
+/**
+ * pidgin_away_prefs_new:
+ *
+ * Creates a new #PidginAwayPrefs instance.
+ *
+ * Returns: (transfer full): The new #PidginAwayPrefs instance.
+ *
+ * Since: 3.0.0
+ */
+GtkWidget *pidgin_away_prefs_new(void);
+
+G_END_DECLS
+
+#endif /* PIDGIN_AWAY_PREFS_H */
--- a/pidgin/resources/Prefs/away.ui Sun May 15 02:27:58 2022 -0500
+++ b/pidgin/resources/Prefs/away.ui Sun May 15 02:33:16 2022 -0500
@@ -75,7 +75,7 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
- <template class="PidginAwayPage" parent="HdyPreferencesPage">
+ <template class="PidginAwayPrefs" parent="HdyPreferencesPage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
--- a/pidgin/resources/Prefs/prefs.ui Sun May 15 02:27:58 2022 -0500
+++ b/pidgin/resources/Prefs/prefs.ui Sun May 15 02:33:16 2022 -0500
@@ -116,7 +116,7 @@
</packing>
</child>
<child>
- <object class="PidginAwayPage">
+ <object class="PidginAwayPrefs">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>