Replace some utility functions with actual widgets

Tue, 15 Sep 2020 20:26:57 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 15 Sep 2020 20:26:57 -0500
changeset 40533
b1921b17b683
parent 40532
1079a910beff
child 40534
8dad2981fb86

Replace some utility functions with actual widgets

Replace pidgin_create_dialog with PidginDialog

Testing Done:
Compile and basic run with im's sent.

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

ChangeLog.API file | annotate | diff | comparison | revisions
doc/reference/pidgin/pidgin-docs.xml file | annotate | diff | comparison | revisions
pidgin/glade/pidgin3.xml.in file | annotate | diff | comparison | revisions
pidgin/gtkaccount.c file | annotate | diff | comparison | revisions
pidgin/gtkblist.c file | annotate | diff | comparison | revisions
pidgin/gtkconv.c file | annotate | diff | comparison | revisions
pidgin/gtkdialogs.c file | annotate | diff | comparison | revisions
pidgin/gtkpounce.c file | annotate | diff | comparison | revisions
pidgin/gtkrequest.c file | annotate | diff | comparison | revisions
pidgin/gtksavedstatuses.c file | annotate | diff | comparison | revisions
pidgin/gtkutils.c file | annotate | diff | comparison | revisions
pidgin/gtkutils.h file | annotate | diff | comparison | revisions
pidgin/meson.build file | annotate | diff | comparison | revisions
pidgin/pidginclosebutton.c file | annotate | diff | comparison | revisions
pidgin/pidginclosebutton.h file | annotate | diff | comparison | revisions
pidgin/pidgindialog.c file | annotate | diff | comparison | revisions
pidgin/pidgindialog.h file | annotate | diff | comparison | revisions
pidgin/pidginwindow.c file | annotate | diff | comparison | revisions
pidgin/pidginwindow.h file | annotate | diff | comparison | revisions
pidgin/plugins/gevolution/add_buddy_dialog.c file | annotate | diff | comparison | revisions
pidgin/plugins/gevolution/assoc-buddy.c file | annotate | diff | comparison | revisions
pidgin/plugins/gevolution/new_person_dialog.c file | annotate | diff | comparison | revisions
pidgin/resources/closebutton.ui file | annotate | diff | comparison | revisions
pidgin/resources/pidgin.gresource.xml file | annotate | diff | comparison | revisions
po/POTFILES.in file | annotate | diff | comparison | revisions
--- a/ChangeLog.API	Mon Sep 14 21:35:28 2020 -0500
+++ b/ChangeLog.API	Tue Sep 15 20:26:57 2020 -0500
@@ -632,6 +632,9 @@
 		* pidgin_conv_placement_get_fnc
 		* pidgin_conv_placement_set_current_func
 		* pidgin_conv_placement_get_current_func
+		* pidgin_create_dialog, use pidgin_dialog_new instead.
+		* pidgin_create_small_button, use pidgin_close_button_new instead.
+		* pidgin_create_window, use pidgin_window_new instead.
 		* PIDGIN_DIALOG
 		* pidgin_dialogs_alias_contact
 		* pidgin_make_pretty_arrows
--- a/doc/reference/pidgin/pidgin-docs.xml	Mon Sep 14 21:35:28 2020 -0500
+++ b/doc/reference/pidgin/pidgin-docs.xml	Tue Sep 15 20:26:57 2020 -0500
@@ -60,8 +60,10 @@
       <xi:include href="xml/pidginactiongroup.xml" />
       <xi:include href="xml/pidginattachment.xml" />
       <xi:include href="xml/pidginbuddylistmenu.xml" />
+      <xi:include href="xml/pidginclosebutton.xml" />
       <xi:include href="xml/pidgincontactcompletion.xml" />
       <xi:include href="xml/pidgindebug.xml" />
+      <xi:include href="xml/pidgindialog.xml" />
       <xi:include href="xml/pidgingdkpixbuf.xml" />
       <xi:include href="xml/pidginicon.xml" />
       <xi:include href="xml/pidgininvitedialog.xml" />
@@ -75,6 +77,7 @@
       <xi:include href="xml/pidginstock.xml" />
       <xi:include href="xml/pidgintalkatu.xml" />
       <xi:include href="xml/pidgintooltip.xml" />
+      <xi:include href="xml/pidginwindow.xml" />
   </part>
 
   <part id="signals">
--- a/pidgin/glade/pidgin3.xml.in	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/glade/pidgin3.xml.in	Tue Sep 15 20:26:57 2020 -0500
@@ -3,17 +3,23 @@
   <glade-widget-classes>
     <glade-widget-class name="PidginAccountChooser" generic-name="account_chooser" title="AccountChooser"/>
     <glade-widget-class name="PidginAccountsMenu" generic-name="accounts_menu" title="AccountsMenu"/>
+    <glade-widget-class name="PidginCloseButton" generic-name="close-button" title="CloseButton"/>
+    <glade-widget-class name="PidginDialog" generic-name="dialog" title="Dialog"/>
     <glade-widget-class name="PidginInviteDialog" generic-name="invite_dialog" title="InviteDialog"/>
     <glade-widget-class name="PidginMenuTray" generic-name="menu_tray" title="MenuTray"/>
     <glade-widget-class name="PidginPluginsMenu" generic-name="plugins_menu" title="PluginsMenu"/>
     <glade-widget-class name="PidginScrollBook" generic-name="scroll_book" title="ScrollBook"/>
+    <glade-widget-class name="PidginWindow" generic-name="window" title="Window"/>
   </glade-widget-classes>
   <glade-widget-group name="pidgin" title="Pidgin">
     <glade-widget-class-ref name="PidginAccountChooser"/>
     <glade-widget-class-ref name="PidginAccountsMenu"/>
+    <glade-widget-class-ref name="PidginCloseButton"/>
+    <glade-widget-class-ref name="PidginDialog"/>
     <glade-widget-class-ref name="PidginInviteDialog"/>
     <glade-widget-class-ref name="PidginMenuTray"/>
     <glade-widget-class-ref name="PidginPluginsMenu"/>
     <glade-widget-class-ref name="PidginScrollBook"/>
+    <glade-widget-class-ref name="PidginWindow"/>
   </glade-widget-group>
 </glade-catalog>
--- a/pidgin/gtkaccount.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtkaccount.c	Tue Sep 15 20:26:57 2020 -0500
@@ -33,6 +33,7 @@
 #include "gtkutils.h"
 #include "gtkstatusbox.h"
 #include "pidgincore.h"
+#include "pidgindialog.h"
 #include "pidginstock.h"
 #include "minidialog.h"
 #include "pidginprotocolchooser.h"
@@ -1624,7 +1625,7 @@
 	dialog->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 	dialog->protocol = purple_protocols_find(dialog->protocol_id);
 
-	dialog->window = win = pidgin_create_dialog((type == PIDGIN_ADD_ACCOUNT_DIALOG) ? _("Add Account") : _("Modify Account"),
+	dialog->window = win = pidgin_dialog_new((type == PIDGIN_ADD_ACCOUNT_DIALOG) ? _("Add Account") : _("Modify Account"),
 		6, "account", FALSE);
 
 	g_signal_connect(G_OBJECT(win), "delete_event",
@@ -2395,7 +2396,7 @@
 	width  = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/accounts/dialog/width");
 	height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/accounts/dialog/height");
 
-	dialog->window = win = pidgin_create_dialog(_("Accounts"), 0, "accounts", TRUE);
+	dialog->window = win = pidgin_dialog_new(_("Accounts"), 0, "accounts", TRUE);
 	gtk_window_set_default_size(GTK_WINDOW(win), width, height);
 
 	g_signal_connect(G_OBJECT(win), "delete_event",
--- a/pidgin/gtkblist.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtkblist.c	Tue Sep 15 20:26:57 2020 -0500
@@ -46,6 +46,7 @@
 #include "pidgin/pidginaccountchooser.h"
 #include "pidgin/pidginactiongroup.h"
 #include "pidgin/pidginbuddylistmenu.h"
+#include "pidgin/pidginclosebutton.h"
 #include "pidgin/pidgincore.h"
 #include "pidgin/pidgindebug.h"
 #include "pidgin/pidgingdkpixbuf.h"
@@ -53,6 +54,7 @@
 #include "pidgin/pidginmooddialog.h"
 #include "pidgin/pidginplugininfo.h"
 #include "pidgin/pidgintooltip.h"
+#include "pidgin/pidginwindow.h"
 #include "pidginmenutray.h"
 #include "pidginstock.h"
 
@@ -5197,7 +5199,7 @@
 	gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
 	gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000);
 
-	gtkblist->window = pidgin_create_window(_("Buddy List"), 0, "buddy_list", TRUE);
+	gtkblist->window = pidgin_window_new(_("Buddy List"), 0, "buddy_list", TRUE);
 	g_signal_connect(G_OBJECT(gtkblist->window), "focus-in-event",
 			 G_CALLBACK(blist_focus_cb), gtkblist);
 	g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event",
@@ -5279,9 +5281,7 @@
 	gtk_box_pack_start(GTK_BOX(content_area), gtkblist->headline_label,
 	                   TRUE, TRUE, 0);
 
-	close = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
-	close = pidgin_create_small_button(close);
-	gtk_widget_set_tooltip_text(close, _("Close"));
+	close = pidgin_close_button_new();
 	gtk_info_bar_add_action_widget(GTK_INFO_BAR(infobar), close,
 	                               GTK_RESPONSE_CLOSE);
 
--- a/pidgin/gtkconv.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtkconv.c	Tue Sep 15 20:26:57 2020 -0500
@@ -51,6 +51,7 @@
 #include "gtkprivacy.h"
 #include "gtkstyle.h"
 #include "gtkutils.h"
+#include "pidginclosebutton.h"
 #include "pidgincore.h"
 #include "pidgingdkpixbuf.h"
 #include "pidgininvitedialog.h"
@@ -59,6 +60,7 @@
 #include "pidginmessage.h"
 #include "pidginstock.h"
 #include "pidgintooltip.h"
+#include "pidginwindow.h"
 
 #include "gtknickcolors.h"
 
@@ -7651,7 +7653,7 @@
 	window_list = g_list_append(window_list, win);
 
 	/* Create the window. */
-	win->window = pidgin_create_window(NULL, 0, "conversation", TRUE);
+	win->window = pidgin_window_new(NULL, 0, "conversation", TRUE);
 	/*_pidgin_widget_set_accessible_name(win->window, "Conversations");*/
 	if (!gtk_get_current_event_state(&state))
 		gtk_window_set_focus_on_map(GTK_WINDOW(win->window), FALSE);
@@ -7915,9 +7917,7 @@
 
 
 	/* Close button. */
-	gtkconv->close = pidgin_create_small_button(gtk_label_new("×"));
-	gtk_widget_set_tooltip_text(gtkconv->close, _("Close conversation"));
-
+	gtkconv->close = pidgin_close_button_new();
 	g_signal_connect(gtkconv->close, "clicked", G_CALLBACK (close_conv_cb), gtkconv);
 
 	/* Status icon. */
--- a/pidgin/gtkdialogs.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtkdialogs.c	Tue Sep 15 20:26:57 2020 -0500
@@ -40,6 +40,7 @@
 #include "gtkdialogs.h"
 #include "gtkutils.h"
 #include "pidgincore.h"
+#include "pidgindialog.h"
 #include "pidginlog.h"
 #include "pidginstock.h"
 
@@ -112,7 +113,7 @@
 	AtkObject *obj;
 	char *filename, *tmp;
 
-	win = pidgin_create_dialog(title, 0, role, TRUE);
+	win = pidgin_dialog_new(title, 0, role, TRUE);
 	vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(win), FALSE, 0);
 	gtk_window_set_default_size(GTK_WINDOW(win), 475, 450);
 
--- a/pidgin/gtkpounce.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtkpounce.c	Tue Sep 15 20:26:57 2020 -0500
@@ -34,6 +34,7 @@
 #include "gtkutils.h"
 #include "pidginaccountchooser.h"
 #include "pidgincore.h"
+#include "pidgindialog.h"
 #include "pidgintalkatu.h"
 
 #include <gdk/gdkkeysyms.h>
@@ -1253,7 +1254,7 @@
 	width  = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/width");
 	height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/pounces/dialog/height");
 
-	dialog->window = win = pidgin_create_dialog(_("Buddy Pounces"), 0, "pounces", TRUE);
+	dialog->window = win = pidgin_dialog_new(_("Buddy Pounces"), 0, "pounces", TRUE);
 
 	gtk_window_set_default_size(GTK_WINDOW(win), width, height);
 
--- a/pidgin/gtkrequest.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtkrequest.c	Tue Sep 15 20:26:57 2020 -0500
@@ -30,6 +30,7 @@
 #include "gtkblist.h"
 #include "pidginaccountchooser.h"
 #include "pidgincore.h"
+#include "pidgindialog.h"
 #include "pidginstock.h"
 
 #include <gdk/gdkkeysyms.h>
@@ -1885,11 +1886,7 @@
 	data->cbs[0] = ok_cb;
 	data->cbs[1] = cancel_cb;
 
-#ifdef _WIN32
-	data->dialog = win = pidgin_create_dialog(PIDGIN_ALERT_TITLE, 12, "multifield", TRUE) ;
-#else /* !_WIN32 */
-	data->dialog = win = pidgin_create_dialog(title, 12, "multifield", TRUE) ;
-#endif /* _WIN32 */
+	data->dialog = win = pidgin_dialog_new(title, 12, "multifield", TRUE) ;
 
 	g_signal_connect(G_OBJECT(win), "delete_event",
 					 G_CALLBACK(destroy_multifield_cb), data);
--- a/pidgin/gtksavedstatuses.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtksavedstatuses.c	Tue Sep 15 20:26:57 2020 -0500
@@ -29,6 +29,7 @@
 #include "gtksavedstatuses.h"
 #include "gtkutils.h"
 #include "pidgincore.h"
+#include "pidgindialog.h"
 #include "pidginstock.h"
 
 /*
@@ -550,7 +551,7 @@
 	width  = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/status/dialog/width");
 	height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/status/dialog/height");
 
-	dialog->window = win = pidgin_create_dialog(_("Saved Statuses"), 12, "statuses", TRUE);
+	dialog->window = win = pidgin_dialog_new(_("Saved Statuses"), 12, "statuses", TRUE);
 	gtk_window_set_default_size(GTK_WINDOW(win), width, height);
 
 	g_signal_connect(G_OBJECT(win), "delete_event",
@@ -1103,7 +1104,7 @@
 	if (edit)
 		dialog->original_title = g_strdup(purple_savedstatus_get_title(saved_status));
 
-	dialog->window = win = pidgin_create_dialog(_("Status"), 12, "status", TRUE);
+	dialog->window = win = pidgin_dialog_new(_("Status"), 12, "status", TRUE);
 
 	g_signal_connect(G_OBJECT(win), "destroy",
 					 G_CALLBACK(status_editor_destroy_cb), dialog);
@@ -1402,7 +1403,7 @@
 	dialog->account = account;
 
 	tmp = g_strdup_printf(_("Status for %s"), purple_account_get_username(account));
-	dialog->window = win = pidgin_create_dialog(tmp, 12, "substatus", TRUE);
+	dialog->window = win = pidgin_dialog_new(tmp, 12, "substatus", TRUE);
 	g_free(tmp);
 
 	g_signal_connect(G_OBJECT(win), "destroy",
--- a/pidgin/gtkutils.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtkutils.c	Tue Sep 15 20:26:57 2020 -0500
@@ -127,61 +127,6 @@
 /******************************************************************************
  * Code
  *****************************************************************************/
-static
-void pidgin_window_init(GtkWindow *wnd, const char *title, guint border_width, const char *role, gboolean resizable)
-{
-	if (title)
-		gtk_window_set_title(wnd, title);
-#ifdef _WIN32
-	else
-		gtk_window_set_title(wnd, PIDGIN_ALERT_TITLE);
-#endif
-	gtk_container_set_border_width(GTK_CONTAINER(wnd), border_width);
-	if (role)
-		gtk_window_set_role(wnd, role);
-	gtk_window_set_resizable(wnd, resizable);
-}
-
-GtkWidget *
-pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable)
-{
-	GtkWindow *wnd = NULL;
-
-	wnd = GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
-	pidgin_window_init(wnd, title, border_width, role, resizable);
-
-	return GTK_WIDGET(wnd);
-}
-
-GtkWidget *
-pidgin_create_small_button(GtkWidget *image)
-{
-	GtkWidget *button;
-
-	button = gtk_button_new();
-	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
-
-	/* don't allow focus on the close button */
-	gtk_widget_set_focus_on_click(button, FALSE);
-
-	gtk_widget_show(image);
-
-	gtk_container_add(GTK_CONTAINER(button), image);
-
-	return button;
-}
-
-GtkWidget *
-pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable)
-{
-	GtkWindow *wnd = NULL;
-
-	wnd = GTK_WINDOW(gtk_dialog_new());
-	pidgin_window_init(wnd, title, border_width, role, resizable);
-
-	return GTK_WIDGET(wnd);
-}
-
 GtkWidget *
 pidgin_create_video_widget(void)
 {
--- a/pidgin/gtkutils.h	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/gtkutils.h	Tue Sep 15 20:26:57 2020 -0500
@@ -84,42 +84,6 @@
 G_BEGIN_DECLS
 
 /**
- * pidgin_create_small_button:
- * @image:   A button image.
- *
- * Creates a small button
- *
- * Returns: (transfer full): A GtkButton created from the image.
- */
-GtkWidget *pidgin_create_small_button(GtkWidget *image);
-
-/**
- * pidgin_create_window:
- * @title:        The window title, or %NULL
- * @border_width: The window's desired border width
- * @role:         A string indicating what the window is responsible for doing, or %NULL
- * @resizable:    Whether the window should be resizable (%TRUE) or not (%FALSE)
- *
- * Creates a new window
- *
- * Returns: (transfer full): A new window.
- */
-GtkWidget *pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable);
-
-/**
- * pidgin_create_dialog:
- * @title:        The window title, or %NULL
- * @border_width: The window's desired border width
- * @role:         A string indicating what the window is responsible for doing, or %NULL
- * @resizable:    Whether the window should be resizable (%TRUE) or not (%FALSE)
- *
- * Creates a new dialog window
- *
- * Returns: (transfer full): A new dialog window.
- */
-GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable);
-
-/**
  * pidgin_create_video_widget:
  *
  * Creates a new drawing area suitable for displaying a video
--- a/pidgin/meson.build	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/meson.build	Tue Sep 15 20:26:57 2020 -0500
@@ -39,8 +39,10 @@
 	'pidginactiongroup.c',
 	'pidginattachment.c',
 	'pidginbuddylistmenu.c',
+	'pidginclosebutton.c',
 	'pidgincontactcompletion.c',
 	'pidgindebug.c',
+	'pidgindialog.c',
 	'pidgingdkpixbuf.c',
 	'pidgininvitedialog.c',
 	'pidginlog.c',
@@ -54,6 +56,7 @@
 	'pidginprotocolstore.c',
 	'pidgintalkatu.c',
 	'pidgintooltip.c',
+	'pidginwindow.c',
 ]
 
 libpidgin_headers = [
@@ -98,8 +101,10 @@
 	'pidginactiongroup.h',
 	'pidginattachment.h',
 	'pidginbuddylistmenu.h',
+	'pidginclosebutton.h',
 	'pidgincontactcompletion.h',
 	'pidgincore.h',
+	'pidgindialog.h',
 	'pidgindebug.h',
 	'pidgingdkpixbuf.h',
 	'pidginicon.h',
@@ -115,6 +120,7 @@
 	'pidginprotocolstore.h',
 	'pidgintalkatu.h',
 	'pidgintooltip.h',
+	'pidginwindow.h',
 ]
 
 pidgin_SOURCES = [
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidginclosebutton.c	Tue Sep 15 20:26:57 2020 -0500
@@ -0,0 +1,54 @@
+/*
+ * pidgin
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "pidginclosebutton.h"
+
+struct _PidginCloseButton {
+	GtkButton parent;
+};
+
+/******************************************************************************
+ * GObject Implementation
+ *****************************************************************************/
+G_DEFINE_TYPE(PidginCloseButton, pidgin_close_button, GTK_TYPE_BUTTON)
+
+static void
+pidgin_close_button_init(PidginCloseButton *button) {
+	gtk_widget_init_template(GTK_WIDGET(button));
+}
+
+static void
+pidgin_close_button_class_init(PidginCloseButtonClass *klass) {
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+
+	gtk_widget_class_set_template_from_resource(
+	    widget_class,
+	    "/im/pidgin/Pidgin/closebutton.ui"
+	);
+}
+
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
+GtkWidget *
+pidgin_close_button_new(void) {
+	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_CLOSE_BUTTON, NULL));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidginclosebutton.h	Tue Sep 15 20:26:57 2020 -0500
@@ -0,0 +1,62 @@
+/*
+ * pidgin
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
+# error "only <pidgin.h> may be included directly"
+#endif
+
+#ifndef PIDGIN_CLOSE_BUTTON_H
+#define PIDGIN_CLOSE_BUTTON_H
+
+/**
+ * SECTION:pidginclosebutton
+ * @section_id: pidgin-close-button
+ * @short_description: A widget to close things.
+ * @title: Close Button
+ *
+ * #PidginCloseButton is a transitional widget as we slowly migrate the
+ * conversation window to glade.
+ */
+
+#include <glib.h>
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PIDGIN_TYPE_CLOSE_BUTTON (pidgin_close_button_get_type())
+G_DECLARE_FINAL_TYPE(PidginCloseButton, pidgin_close_button, PIDGIN,
+                     CLOSE_BUTTON, GtkButton)
+
+/**
+ * pidgin_close_button_new:
+ *
+ * Creates a new #PidginCloseButton instance.
+ *
+ * Returns: (transfer full): The new #PidginCloseButton instance.
+ *
+ * Since: 3.0.0
+ */
+GtkWidget *pidgin_close_button_new(void);
+
+G_END_DECLS
+
+#endif /* PIDGIN_CLOSE_BUTTON_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidgindialog.c	Tue Sep 15 20:26:57 2020 -0500
@@ -0,0 +1,61 @@
+/*
+ * pidgin
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "pidgindialog.h"
+
+#include "pidgincore.h"
+
+struct _PidginDialog {
+	GtkDialog parent;
+};
+
+/******************************************************************************
+ * GObject Implementation
+ *****************************************************************************/
+G_DEFINE_TYPE(PidginDialog, pidgin_dialog, GTK_TYPE_DIALOG)
+
+static void
+pidgin_dialog_init(PidginDialog *button) {
+}
+
+static void
+pidgin_dialog_class_init(PidginDialogClass *klass) {
+}
+
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
+GtkWidget *
+pidgin_dialog_new(const gchar *title, guint border_width, const gchar *role,
+                  gboolean resizable)
+{
+	if(title == NULL) {
+		title = PIDGIN_ALERT_TITLE;
+	}
+
+	return GTK_WIDGET(g_object_new(
+		PIDGIN_TYPE_DIALOG,
+		"title", title,
+		"border-width", border_width,
+		"role", role,
+		"resizable", resizable,
+		NULL));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidgindialog.h	Tue Sep 15 20:26:57 2020 -0500
@@ -0,0 +1,67 @@
+/*
+ * pidgin
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
+# error "only <pidgin.h> may be included directly"
+#endif
+
+#ifndef PIDGIN_DIALOG_H
+#define PIDGIN_DIALOG_H
+
+/**
+ * SECTION:pidgindialog
+ * @section_id: pidgin-dialog
+ * @short_description: A base dialog widget.
+ * @title: Dialog
+ *
+ * #PidginDialog is a transitional widget as we slowly migrate everything to
+ * glade.
+ */
+
+#include <glib.h>
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PIDGIN_TYPE_DIALOG (pidgin_dialog_get_type())
+G_DECLARE_FINAL_TYPE(PidginDialog, pidgin_dialog, PIDGIN,
+                     DIALOG, GtkDialog)
+
+/**
+ * pidgin_dialog_new:
+ * @title: The dialog title, or %NULL.
+ * @border_width: The dialog's desired border width.
+ * @role: A string indicating what the dialog is responsible for doing, or
+ *        %NULL.
+ * @resizable: Whether the dialog should be resizable.
+ *
+ * Creates a new #PidginDialog instance.
+ *
+ * Returns: (transfer full): The new #PidginDialog instance.
+ *
+ * Since: 3.0.0
+ */
+GtkWidget *pidgin_dialog_new(const gchar *title, guint border_width, const gchar *role, gboolean resizable);
+
+G_END_DECLS
+
+#endif /* PIDGIN_DIALOG_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidginwindow.c	Tue Sep 15 20:26:57 2020 -0500
@@ -0,0 +1,61 @@
+/*
+ * pidgin
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "pidginwindow.h"
+
+#include "pidgincore.h"
+
+struct _PidginWindow {
+	GtkWindow parent;
+};
+
+/******************************************************************************
+ * GObject Implementation
+ *****************************************************************************/
+G_DEFINE_TYPE(PidginWindow, pidgin_window, GTK_TYPE_WINDOW)
+
+static void
+pidgin_window_init(PidginWindow *button) {
+}
+
+static void
+pidgin_window_class_init(PidginWindowClass *klass) {
+}
+
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
+GtkWidget *
+pidgin_window_new(const gchar *title, guint border_width, const gchar *role,
+                  gboolean resizable)
+{
+	if(title == NULL) {
+		title = PIDGIN_ALERT_TITLE;
+	}
+
+	return GTK_WIDGET(g_object_new(
+		PIDGIN_TYPE_WINDOW,
+		"title", title,
+		"border-width", border_width,
+		"role", role,
+		"resizable", resizable,
+		NULL));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/pidginwindow.h	Tue Sep 15 20:26:57 2020 -0500
@@ -0,0 +1,67 @@
+/*
+ * pidgin
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
+# error "only <pidgin.h> may be included directly"
+#endif
+
+#ifndef PIDGIN_WINDOW_H
+#define PIDGIN_WINDOW_H
+
+/**
+ * SECTION:pidginwindow
+ * @section_id: pidgin-window
+ * @short_description: A base window widget.
+ * @title: Window
+ *
+ * #PidginWindow is a transitional widget as we slowly migrate everything to
+ * glade.
+ */
+
+#include <glib.h>
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PIDGIN_TYPE_WINDOW (pidgin_window_get_type())
+G_DECLARE_FINAL_TYPE(PidginWindow, pidgin_window, PIDGIN,
+                     WINDOW, GtkWindow)
+
+/**
+ * pidgin_window_new:
+ * @title: The window title, or %NULL.
+ * @border_width: The window's desired border width.
+ * @role: A string indicating what the window is responsible for doing, or
+ *        %NULL.
+ * @resizable: Whether the window should be resizable.
+ *
+ * Creates a new #PidginWindow instance.
+ *
+ * Returns: (transfer full): The new #PidginWindow instance.
+ *
+ * Since: 3.0.0
+ */
+GtkWidget *pidgin_window_new(const gchar *title, guint border_width, const gchar *role, gboolean resizable);
+
+G_END_DECLS
+
+#endif /* PIDGIN_WINDOW_H */
--- a/pidgin/plugins/gevolution/add_buddy_dialog.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/plugins/gevolution/add_buddy_dialog.c	Tue Sep 15 20:26:57 2020 -0500
@@ -425,7 +425,7 @@
 	if (username != NULL)
 		dialog->username = g_strdup(username);
 
-	dialog->win = pidgin_create_window(_("Add Buddy"), 12, "add_buddy", TRUE);
+	dialog->win = pidgin_window_new(_("Add Buddy"), 12, "add_buddy", TRUE);
 	gtk_widget_set_size_request(dialog->win, -1, 400);
 
 	g_signal_connect(G_OBJECT(dialog->win), "delete_event",
--- a/pidgin/plugins/gevolution/assoc-buddy.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/plugins/gevolution/assoc-buddy.c	Tue Sep 15 20:26:57 2020 -0500
@@ -316,7 +316,7 @@
 
 	dialog->buddy = buddy;
 
-	dialog->win = pidgin_create_window(NULL, 12, "assoc_buddy", TRUE);
+	dialog->win = pidgin_window_new(NULL, 12, "assoc_buddy", TRUE);
 
 	g_signal_connect(G_OBJECT(dialog->win), "delete_event",
 					 G_CALLBACK(delete_win_cb), dialog);
--- a/pidgin/plugins/gevolution/new_person_dialog.c	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/plugins/gevolution/new_person_dialog.c	Tue Sep 15 20:26:57 2020 -0500
@@ -234,7 +234,7 @@
 	dialog->book = book;
 	g_object_ref(book);
 
-	dialog->win = pidgin_create_window(_("New Person"), 12, "new_person", FALSE);
+	dialog->win = pidgin_window_new(_("New Person"), 12, "new_person", FALSE);
 
 	g_signal_connect(G_OBJECT(dialog->win), "delete_event",
 					 G_CALLBACK(delete_win_cb), dialog);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/closebutton.ui	Tue Sep 15 20:26:57 2020 -0500
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.2 
+
+Pidgin - Internet Messenger
+Copyright (C) Pidgin Developers <devel@pidgin.im>
+
+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 <http://www.gnu.org/licenses/>.
+
+-->
+<interface>
+  <requires lib="gtk+" version="3.20"/>
+  <!-- interface-license-type gplv2 -->
+  <!-- interface-name Pidgin -->
+  <!-- interface-description Internet Messenger -->
+  <!-- interface-copyright Pidgin Developers <devel@pidgin.im> -->
+  <template class="PidginCloseButton" parent="GtkButton">
+    <property name="visible">True</property>
+    <property name="can_focus">True</property>
+    <property name="focus_on_click">False</property>
+    <property name="receives_default">True</property>
+    <property name="tooltip_text" translatable="yes">Close</property>
+    <property name="relief">none</property>
+    <child>
+      <object class="GtkLabel">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">×</property>
+        <property name="single_line_mode">True</property>
+      </object>
+    </child>
+  </template>
+</interface>
--- a/pidgin/resources/pidgin.gresource.xml	Mon Sep 14 21:35:28 2020 -0500
+++ b/pidgin/resources/pidgin.gresource.xml	Tue Sep 15 20:26:57 2020 -0500
@@ -22,5 +22,6 @@
     <file compressed="true">Roomlist/roomlist.ui</file>
     <file compressed="true">Whiteboard/whiteboard.ui</file>
     <file compressed="true">Xfer/xfer.ui</file>
+    <file compressed="true">closebutton.ui</file>
   </gresource>
 </gresources>
--- a/po/POTFILES.in	Mon Sep 14 21:35:28 2020 -0500
+++ b/po/POTFILES.in	Tue Sep 15 20:26:57 2020 -0500
@@ -345,8 +345,10 @@
 pidgin/pidginabout.c
 pidgin/pidgin.c
 pidgin/pidginattachment.c
+pidgin/pidginclosebutton.c
 pidgin/pidgincontactcompletion.c
 pidgin/pidgindebug.c
+pidgin/pidgindialog.c
 pidgin/pidgingdkpixbuf.c
 pidgin/pidgininvitedialog.c
 pidgin/pidginlog.c
@@ -355,6 +357,7 @@
 pidgin/pidginstock.c
 pidgin/pidgintalkatu.c
 pidgin/pidgintooltip.c
+pidgin/pidginwindow.c
 pidgin/plugins/contact_priority.c
 pidgin/plugins/disco/gtkdisco.c
 pidgin/plugins/disco/xmppdisco.c
@@ -398,6 +401,7 @@
 pidgin/resources/Debug/debug.ui
 pidgin/resources/Debug/plugininfo.ui
 pidgin/resources/Conversations/invite_dialog.ui
+pidgin/resources/closebutton.ui
 pidgin/win32/gtkwin32dep.c
 pidgin/win32/untar.c
 pidgin/win32/winpidgin.c

mercurial