Convert File Transfer dialog to Glade.

Thu, 28 Jun 2018 01:09:49 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Thu, 28 Jun 2018 01:09:49 -0400
changeset 39839
95c968a8ed72
parent 39827
bd658a6cc1a7
child 39840
9fd369520d93

Convert File Transfer dialog to Glade.

pidgin/gtkxfer.c file | annotate | diff | comparison | revisions
pidgin/gtkxfer.h file | annotate | diff | comparison | revisions
pidgin/resources/Xfer/xfer.ui file | annotate | diff | comparison | revisions
pidgin/resources/pidgin.gresource.xml file | annotate | diff | comparison | revisions
--- a/pidgin/gtkxfer.c	Fri Sep 13 01:27:15 2019 +0000
+++ b/pidgin/gtkxfer.c	Thu Jun 28 01:09:49 2018 -0400
@@ -43,23 +43,20 @@
 
 struct _PidginXferDialog
 {
-	gint box_count;
+	GtkDialog parent;
 
-	gboolean keep_open;
-	gboolean auto_clear;
+	GtkWidget *keep_open;
+	GtkWidget *auto_clear;
 
 	gint num_transfers;
 
 	PurpleXfer *selected_xfer;
 
-	GtkWidget *window;
 	GtkWidget *tree;
 	GtkListStore *model;
 
 	GtkWidget *expander;
 
-	GtkWidget *grid;
-
 	GtkWidget *local_user_desc_label;
 	GtkWidget *local_user_label;
 	GtkWidget *remote_user_desc_label;
@@ -81,6 +78,8 @@
 	GtkWidget *close_button;
 };
 
+G_DEFINE_TYPE(PidginXferDialog, pidgin_xfer_dialog, GTK_TYPE_DIALOG);
+
 typedef struct
 {
 	GtkTreeIter iter;
@@ -189,9 +188,6 @@
 	guint64 total_bytes_xferred = 0;
 	guint64 total_file_size = 0;
 
-	if (dialog->window == NULL)
-		return;
-
 	valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dialog->model), &iter);
 
 	/* Find all active transfers */
@@ -227,10 +223,10 @@
 						 "File Transfers - %d%% of %d files",
 						 num_active_xfers),
 					total_pct, num_active_xfers);
-		gtk_window_set_title(GTK_WINDOW(dialog->window), title);
+		gtk_window_set_title(GTK_WINDOW(dialog), title);
 		g_free(title);
 	} else {
-		gtk_window_set_title(GTK_WINDOW(dialog->window), _("File Transfers"));
+		gtk_window_set_title(GTK_WINDOW(dialog), _("File Transfers"));
 	}
 }
 
@@ -396,19 +392,19 @@
 }
 
 static void
-toggle_keep_open_cb(GtkWidget *w, PidginXferDialog *dialog)
+toggle_keep_open_cb(GtkWidget *w, G_GNUC_UNUSED gpointer data)
 {
-	dialog->keep_open = !dialog->keep_open;
-	purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/filetransfer/keep_open",
-						dialog->keep_open);
+	purple_prefs_set_bool(
+	        PIDGIN_PREFS_ROOT "/filetransfer/keep_open",
+	        !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)));
 }
 
 static void
-toggle_clear_finished_cb(GtkWidget *w, PidginXferDialog *dialog)
+toggle_clear_finished_cb(GtkWidget *w, G_GNUC_UNUSED gpointer data)
 {
-	dialog->auto_clear = !dialog->auto_clear;
-	purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/filetransfer/clear_finished",
-						dialog->auto_clear);
+	purple_prefs_set_bool(
+	        PIDGIN_PREFS_ROOT "/filetransfer/clear_finished",
+	        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)));
 }
 
 static void
@@ -549,250 +545,104 @@
 /**************************************************************************
  * Dialog Building Functions
  **************************************************************************/
-static GtkWidget *
-setup_tree(PidginXferDialog *dialog)
-{
-	GtkWidget *tree;
-	GtkListStore *model;
-	GtkCellRenderer *renderer;
-	GtkTreeViewColumn *column;
-	GtkTreeSelection *selection;
-
-	/* Build the tree model */
-	/* Transfer type, Progress Bar, Filename, Size, Remaining */
-	model = gtk_list_store_new(NUM_COLUMNS, G_TYPE_STRING, G_TYPE_INT,
-							   G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
-							   G_TYPE_POINTER);
-	dialog->model = model;
-
-	/* Create the treeview */
-	dialog->tree = tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
-	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
-	/* gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); */
-
-	gtk_widget_show(tree);
-
-	g_signal_connect(G_OBJECT(selection), "changed",
-					 G_CALLBACK(selection_changed_cb), dialog);
-
-	g_object_unref(G_OBJECT(model));
-
-
-	/* Columns */
-
-	/* Transfer Type column */
-	renderer = gtk_cell_renderer_pixbuf_new();
-	column = gtk_tree_view_column_new_with_attributes(NULL, renderer,
-				"icon-name", COLUMN_STATUS, NULL);
-	gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
-									GTK_TREE_VIEW_COLUMN_FIXED);
-	gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column), 25);
-	gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
-	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
-
-	/* Progress bar column */
-	renderer = gtk_cell_renderer_progress_new();
-	column = gtk_tree_view_column_new_with_attributes(_("Progress"), renderer,
-				"value", COLUMN_PROGRESS, NULL);
-	gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
-	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
-
-	/* Filename column */
-	renderer = gtk_cell_renderer_text_new();
-	column = gtk_tree_view_column_new_with_attributes(_("Filename"), renderer,
-				"text", COLUMN_FILENAME, NULL);
-	gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
-	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
-
-	/* File Size column */
-	renderer = gtk_cell_renderer_text_new();
-	column = gtk_tree_view_column_new_with_attributes(_("Size"), renderer,
-				"text", COLUMN_SIZE, NULL);
-	gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
-	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
-
-	/* Bytes Remaining column */
-	renderer = gtk_cell_renderer_text_new();
-	column = gtk_tree_view_column_new_with_attributes(_("Remaining"),
-				renderer, "text", COLUMN_REMAINING, NULL);
-	gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
-	gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
-
-	gtk_tree_view_columns_autosize(GTK_TREE_VIEW(tree));
-
-	gtk_widget_show(tree);
-
-	return tree;
-}
-
-static GtkWidget *
-make_info_grid(PidginXferDialog *dialog)
-{
-	GtkWidget *grid;
-	GtkWidget *label;
-	gsize i;
-
-	struct
-	{
-		GtkWidget **desc_label;
-		GtkWidget **val_label;
-		const char *desc;
-
-	} labels[] =
-	{
-		{ &dialog->local_user_desc_label, &dialog->local_user_label, NULL },
-		{ &dialog->remote_user_desc_label, &dialog->remote_user_label, NULL },
-		{ &label, &dialog->protocol_label,       _("Protocol:") },
-		{ &label, &dialog->filename_label,       _("Filename:") },
-		{ &label, &dialog->localfile_label,      _("Local File:") },
-		{ &label, &dialog->status_label,         _("Status:") },
-		{ &label, &dialog->speed_label,          _("Speed:") },
-		{ &label, &dialog->time_elapsed_label,   _("Time Elapsed:") },
-		{ &label, &dialog->time_remaining_label, _("Time Remaining:") }
-	};
-
-	/* Setup the initial grid */
-	dialog->grid = grid = gtk_grid_new();
-	gtk_grid_set_row_spacing(GTK_GRID(grid), PIDGIN_HIG_BOX_SPACE);
-	gtk_grid_set_column_spacing(GTK_GRID(grid), PIDGIN_HIG_BOX_SPACE);
-
-	/* Setup the labels */
-	for (i = 0; i < G_N_ELEMENTS(labels); i++) {
-		GtkWidget *label;
-		char buf[256];
-
-		g_snprintf(buf, sizeof(buf), "<b>%s</b>",
-			   labels[i].desc != NULL ? labels[i].desc : "");
-
-		*labels[i].desc_label = label = gtk_label_new(NULL);
-		gtk_label_set_markup(GTK_LABEL(label), buf);
-		gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
-		gtk_label_set_xalign(GTK_LABEL(label), 0);
-		gtk_grid_attach(GTK_GRID(grid), label, 0, i, 1, 1);
-		gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
-
-		gtk_widget_show(label);
-
-		*labels[i].val_label = label = gtk_label_new(NULL);
-		gtk_label_set_xalign(GTK_LABEL(label), 0);
-		gtk_grid_attach(GTK_GRID(grid), label, 1, i, 1, 1);
-		gtk_widget_set_hexpand(label, TRUE);
-		gtk_widget_set_valign(label, GTK_ALIGN_CENTER);
-
-		gtk_widget_show(label);
-	}
-
-	/* Setup the progress bar */
-	dialog->progress = gtk_progress_bar_new();
-	gtk_grid_attach(GTK_GRID(grid), dialog->progress,
-		0, G_N_ELEMENTS(labels), 2, 1);
-
-	gtk_widget_show(dialog->progress);
-
-	return grid;
-}
-
 PidginXferDialog *
 pidgin_xfer_dialog_new(void)
 {
-	PidginXferDialog *dialog;
-	GtkWidget *window;
-	GtkWidget *vbox;
-	GtkWidget *expander;
-	GtkWidget *grid;
-	GtkWidget *checkbox;
-	GtkWidget *bbox;
+	return PIDGIN_XFER_DIALOG(g_object_new(PIDGIN_TYPE_XFER_DIALOG, NULL));
+}
+
+static void
+pidgin_xfer_dialog_class_init(PidginXferDialogClass *klass)
+{
+	GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+
+	gtk_widget_class_set_template_from_resource(
+	        widget_class, "/im/pidgin/Pidgin/Xfer/xfer.ui");
+
+	gtk_widget_class_bind_template_callback(widget_class, delete_win_cb);
 
-	dialog = g_new0(PidginXferDialog, 1);
-	dialog->keep_open =
-		purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/keep_open");
-	dialog->auto_clear =
-		purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/clear_finished");
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     tree);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     model);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        selection_changed_cb);
+
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     keep_open);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        toggle_keep_open_cb);
+
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     auto_clear);
+	gtk_widget_class_bind_template_callback(widget_class,
+	                                        toggle_clear_finished_cb);
+
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     expander);
 
-	/* Create the window. */
-	dialog->window = window = pidgin_create_dialog(_("File Transfers"), 0, "file transfer", TRUE);
-	gtk_window_set_default_size(GTK_WINDOW(window), 450, 250);
-
-	g_signal_connect(G_OBJECT(window), "delete_event",
-					 G_CALLBACK(delete_win_cb), dialog);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     local_user_desc_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     local_user_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     remote_user_desc_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     remote_user_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     protocol_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     filename_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     localfile_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     status_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     speed_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     time_elapsed_label);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     time_remaining_label);
 
-	/* Create the main vbox for top half of the window. */
-	vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(window), FALSE, PIDGIN_HIG_BORDER);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     progress);
 
-	/* Setup the listbox */
-	gtk_box_pack_start(GTK_BOX(vbox),
-		pidgin_make_scrollable(setup_tree(dialog), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, 140),
-		TRUE, TRUE, 0);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     open_button);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     remove_button);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     stop_button);
+	gtk_widget_class_bind_template_child(widget_class, PidginXferDialog,
+	                                     close_button);
+
+	gtk_widget_class_bind_template_callback(widget_class, open_button_cb);
+	gtk_widget_class_bind_template_callback(widget_class, remove_button_cb);
+	gtk_widget_class_bind_template_callback(widget_class, stop_button_cb);
+	gtk_widget_class_bind_template_callback(widget_class, close_button_cb);
+}
+
+static void
+pidgin_xfer_dialog_init(PidginXferDialog *dialog)
+{
+	gtk_widget_init_template(GTK_WIDGET(dialog));
 
 	/* "Close this window when all transfers finish" */
-	checkbox = gtk_check_button_new_with_mnemonic(
-			_("Close this window when all transfers _finish"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
-								 !dialog->keep_open);
-	g_signal_connect(G_OBJECT(checkbox), "toggled",
-					 G_CALLBACK(toggle_keep_open_cb), dialog);
-	gtk_box_pack_start(GTK_BOX(vbox), checkbox, FALSE, FALSE, 0);
-	gtk_widget_show(checkbox);
+	gtk_toggle_button_set_active(
+	        GTK_TOGGLE_BUTTON(dialog->keep_open),
+	        !purple_prefs_get_bool(PIDGIN_PREFS_ROOT
+	                               "/filetransfer/keep_open"));
 
 	/* "Clear finished transfers" */
-	checkbox = gtk_check_button_new_with_mnemonic(
-			_("C_lear finished transfers"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
-								 dialog->auto_clear);
-	g_signal_connect(G_OBJECT(checkbox), "toggled",
-					 G_CALLBACK(toggle_clear_finished_cb), dialog);
-	gtk_box_pack_start(GTK_BOX(vbox), checkbox, FALSE, FALSE, 0);
-	gtk_widget_show(checkbox);
-
-	/* "Download Details" arrow */
-	expander = gtk_expander_new_with_mnemonic(_("File transfer _details"));
-	dialog->expander = expander;
-	gtk_box_pack_start(GTK_BOX(vbox), expander, FALSE, FALSE, 0);
-	gtk_widget_show(expander);
-
-	gtk_widget_set_sensitive(expander, FALSE);
-
-	/* The grid of information. */
-	grid = make_info_grid(dialog);
-	gtk_container_add(GTK_CONTAINER(expander), grid);
-	gtk_widget_show(grid);
-
-	/* Small indent make grid fall under GtkExpander's label */
-	gtk_widget_set_margin_start(grid, 20);
-
-	bbox = pidgin_dialog_get_action_area(GTK_DIALOG(window));
-
-#define ADD_BUTTON(b, label, callback, callbackdata) do { \
-		GtkWidget *button = gtk_button_new_from_stock(label); \
-		gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); \
-		g_signal_connect(G_OBJECT(button), "clicked", callback, callbackdata); \
-		gtk_widget_show(button); \
-		b = button; \
-	} while (0)
-
-	/* Open button */
-	ADD_BUTTON(dialog->open_button, GTK_STOCK_OPEN, G_CALLBACK(open_button_cb), dialog);
-	gtk_widget_set_sensitive(dialog->open_button, FALSE);
-
-	/* Remove button */
-	ADD_BUTTON(dialog->remove_button, GTK_STOCK_REMOVE, G_CALLBACK(remove_button_cb), dialog);
-	gtk_widget_hide(dialog->remove_button);
-
-	/* Stop button */
-	ADD_BUTTON(dialog->stop_button, GTK_STOCK_STOP, G_CALLBACK(stop_button_cb), dialog);
-	gtk_widget_set_sensitive(dialog->stop_button, FALSE);
-
-	/* Close button */
-	ADD_BUTTON(dialog->close_button, GTK_STOCK_CLOSE, G_CALLBACK(close_button_cb), dialog);
-
-#undef ADD_BUTTON
+	gtk_toggle_button_set_active(
+	        GTK_TOGGLE_BUTTON(dialog->auto_clear),
+	        purple_prefs_get_bool(PIDGIN_PREFS_ROOT
+	                              "/filetransfer/clear_finished"));
 
 #ifdef _WIN32
-	g_signal_connect(G_OBJECT(dialog->window), "show",
-		G_CALLBACK(winpidgin_ensure_onscreen), dialog->window);
+	g_signal_connect(G_OBJECT(dialog), "show",
+	                 G_CALLBACK(winpidgin_ensure_onscreen), NULL);
 #endif
-
-	return dialog;
 }
 
 void
@@ -802,9 +652,7 @@
 
 	purple_notify_close_with_handle(dialog);
 
-	gtk_widget_destroy(dialog->window);
-
-	g_free(dialog);
+	gtk_widget_destroy(GTK_WIDGET(dialog));
 }
 
 void
@@ -820,9 +668,9 @@
 			pidgin_set_xfer_dialog(tmp);
 		}
 
-		gtk_widget_show(tmp->window);
+		gtk_widget_show(GTK_WIDGET(tmp));
 	} else {
-		gtk_window_present(GTK_WINDOW(dialog->window));
+		gtk_window_present(GTK_WINDOW(dialog));
 	}
 }
 
@@ -833,7 +681,7 @@
 
 	purple_notify_close_with_handle(dialog);
 
-	gtk_widget_hide(dialog->window);
+	gtk_widget_hide(GTK_WIDGET(dialog));
 }
 
 void
@@ -939,7 +787,9 @@
 	if (!data->in_list)
 		return;
 
-	if ((purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) && (dialog->auto_clear)) {
+	if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL &&
+	    gtk_toggle_button_get_active(
+	            GTK_TOGGLE_BUTTON(dialog->auto_clear))) {
 		pidgin_xfer_dialog_remove_xfer(dialog, xfer);
 		return;
 	}
@@ -1014,17 +864,22 @@
 	if (xfer == dialog->selected_xfer)
 		update_detailed_info(xfer_dialog, xfer);
 
-	if (purple_xfer_is_completed(xfer) && dialog->auto_clear)
+	if (purple_xfer_is_completed(xfer) &&
+	    gtk_toggle_button_get_active(
+	            GTK_TOGGLE_BUTTON(dialog->auto_clear))) {
 		pidgin_xfer_dialog_remove_xfer(dialog, xfer);
-	else
+	} else {
 		update_buttons(dialog, xfer);
+	}
 
 	/*
 	 * If all transfers are finished, and the pref is set, then
 	 * close the dialog.  Otherwise just exit this function.
 	 */
-	if (dialog->keep_open)
+	if (!gtk_toggle_button_get_active(
+	            GTK_TOGGLE_BUTTON(dialog->keep_open))) {
 		return;
+	}
 
 	valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dialog->model), &iter);
 	while (valid)
@@ -1048,43 +903,6 @@
 }
 
 /**************************************************************************
- * PidginXferDialog GBoxed code
- **************************************************************************/
-static PidginXferDialog *
-pidgin_xfer_dialog_ref(PidginXferDialog *dialog)
-{
-	g_return_val_if_fail(dialog != NULL, NULL);
-
-	dialog->box_count++;
-
-	return dialog;
-}
-
-static void
-pidgin_xfer_dialog_unref(PidginXferDialog *dialog)
-{
-	g_return_if_fail(dialog != NULL);
-	g_return_if_fail(dialog->box_count >= 0);
-
-	if (!dialog->box_count--)
-		pidgin_xfer_dialog_destroy(dialog);
-}
-
-GType
-pidgin_xfer_dialog_get_type(void)
-{
-	static GType type = 0;
-
-	if (type == 0) {
-		type = g_boxed_type_register_static("PidginXferDialog",
-				(GBoxedCopyFunc)pidgin_xfer_dialog_ref,
-				(GBoxedFreeFunc)pidgin_xfer_dialog_unref);
-	}
-
-	return type;
-}
-
-/**************************************************************************
  * File Transfer UI Ops
  **************************************************************************/
 static void
--- a/pidgin/gtkxfer.h	Fri Sep 13 01:27:15 2019 +0000
+++ b/pidgin/gtkxfer.h	Thu Jun 28 01:09:49 2018 -0400
@@ -30,6 +30,8 @@
 
 #include "xfer.h"
 
+G_BEGIN_DECLS
+
 /**
  * PidginXferDialog:
  *
@@ -38,24 +40,15 @@
  * The structure is opaque, as nobody should be touching anything inside of
  * it.
  */
-typedef struct _PidginXferDialog PidginXferDialog;
-
 #define PIDGIN_TYPE_XFER_DIALOG (pidgin_xfer_dialog_get_type())
-
-G_BEGIN_DECLS
+G_DECLARE_FINAL_TYPE(PidginXferDialog, pidgin_xfer_dialog, PIDGIN, XFER_DIALOG,
+                     GtkDialog)
 
 /**************************************************************************/
 /* GTK+ File Transfer Dialog API                                          */
 /**************************************************************************/
 
 /**
- * pidgin_xfer_dialog_get_type:
- *
- * Returns: The #GType for the #PidginXferDialog boxed structure.
- */
-GType pidgin_xfer_dialog_get_type(void);
-
-/**
  * pidgin_xfer_dialog_new:
  *
  * Creates a new file transfer dialog.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pidgin/resources/Xfer/xfer.ui	Thu Jun 28 01:09:49 2018 -0400
@@ -0,0 +1,534 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <object class="GtkListStore" id="model">
+    <columns>
+      <!-- column-name status -->
+      <column type="gchararray"/>
+      <!-- column-name progress -->
+      <column type="gint"/>
+      <!-- column-name filename -->
+      <column type="gchararray"/>
+      <!-- column-name size -->
+      <column type="gchararray"/>
+      <!-- column-name remaining -->
+      <column type="gchararray"/>
+      <!-- column-name data -->
+      <column type="gpointer"/>
+    </columns>
+  </object>
+  <template class="PidginXferDialog" parent="GtkDialog">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">File Transfer</property>
+    <property name="role">file transfer</property>
+    <property name="default_width">450</property>
+    <property name="default_height">250</property>
+    <property name="type_hint">normal</property>
+    <signal name="delete-event" handler="delete_win_cb" swapped="no"/>
+    <child>
+      <placeholder/>
+    </child>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="open_button">
+                <property name="label" translatable="yes">_Open</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="open_button_cb" object="PidginXferDialog" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="remove_button">
+                <property name="label" translatable="yes">_Remove</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="remove_button_cb" object="PidginXferDialog" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="stop_button">
+                <property name="label" translatable="yes">_Stop</property>
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="stop_button_cb" object="PidginXferDialog" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="close_button">
+                <property name="label" translatable="yes">_Close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+                <signal name="clicked" handler="close_button_cb" object="PidginXferDialog" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkScrolledWindow">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="shadow_type">in</property>
+                <property name="min_content_height">140</property>
+                <child>
+                  <object class="GtkTreeView" id="tree">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="model">model</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection">
+                        <signal name="changed" handler="selection_changed_cb" object="PidginXferDialog" swapped="no"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn">
+                        <property name="resizable">True</property>
+                        <property name="sizing">fixed</property>
+                        <property name="fixed_width">25</property>
+                        <child>
+                          <object class="GtkCellRendererPixbuf"/>
+                          <attributes>
+                            <attribute name="icon-name">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn">
+                        <property name="resizable">True</property>
+                        <property name="title" translatable="yes">Progress</property>
+                        <child>
+                          <object class="GtkCellRendererProgress"/>
+                          <attributes>
+                            <attribute name="value">1</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn">
+                        <property name="resizable">True</property>
+                        <property name="title" translatable="yes">Filename</property>
+                        <child>
+                          <object class="GtkCellRendererText"/>
+                          <attributes>
+                            <attribute name="text">2</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn">
+                        <property name="resizable">True</property>
+                        <property name="title" translatable="yes">Size</property>
+                        <child>
+                          <object class="GtkCellRendererText"/>
+                          <attributes>
+                            <attribute name="text">3</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn">
+                        <property name="resizable">True</property>
+                        <property name="title" translatable="yes">Remaining</property>
+                        <child>
+                          <object class="GtkCellRendererText"/>
+                          <attributes>
+                            <attribute name="text">4</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="keep_open">
+                <property name="label" translatable="yes">Close this window when all transfers _finish</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="toggle_keep_open_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="auto_clear">
+                <property name="label" translatable="yes">C_lear finished transfers</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="toggle_clear_finished_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkExpander" id="expander">
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="resize_toplevel">True</property>
+                <child>
+                  <object class="GtkGrid">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">20</property>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">6</property>
+                    <child>
+                      <object class="GtkLabel" id="local_user_desc_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="remote_user_desc_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Protocol:</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Filename:</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Local File:</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Status:</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Speed:</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Time Elapsed:</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">7</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Time Remaining:</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">8</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="local_user_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="remote_user_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="protocol_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="filename_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="localfile_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="status_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="speed_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">6</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="time_elapsed_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">7</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="time_remaining_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="justify">right</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="top_attach">8</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkProgressBar" id="progress">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="show_text">True</property>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">9</property>
+                        <property name="width">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">File transfer _details</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
--- a/pidgin/resources/pidgin.gresource.xml	Fri Sep 13 01:27:15 2019 +0000
+++ b/pidgin/resources/pidgin.gresource.xml	Thu Jun 28 01:09:49 2018 -0400
@@ -13,5 +13,6 @@
     <file compressed="true">Prefs/prefs.ui</file>
     <file compressed="true">Prefs/vv.ui</file>
     <file compressed="true">Whiteboard/whiteboard.ui</file>
+    <file compressed="true">Xfer/xfer.ui</file>
   </gresource>
 </gresources>

mercurial