Ejemplo n.º 1
0
void pidgin_icon_theme_edit(PurplePluginAction *unused)
{
	GtkWidget *dialog;
	GtkWidget *box, *vbox;
	GtkWidget *notebook;
	GtkSizeGroup *sizegroup;
	int s, i, j;
	dialog = pidgin_create_dialog(_("Pidgin Icon Theme Editor"), 0, "theme-editor-icon", FALSE);
	box = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(dialog), FALSE, PIDGIN_HIG_BOX_SPACE);

	notebook = gtk_notebook_new();
	gtk_box_pack_start(GTK_BOX(box), notebook, TRUE, TRUE, PIDGIN_HIG_BOX_SPACE);
	sizegroup = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);

	for (s = 0; sections[s].heading; s++) {
		const char *heading = sections[s].heading;

		box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
		gtk_notebook_append_page(GTK_NOTEBOOK(notebook), box, gtk_label_new(heading));

		vbox = pidgin_make_frame(box, heading);
		g_object_set_data(G_OBJECT(dialog), heading, vbox);

		for (i = 0; sections[s].options[i].stockid; i++) {
			const char *id = sections[s].options[i].stockid;
			const char *text = _(sections[s].options[i].text);

			GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_CAT_SPACE);
			GtkWidget *label = gtk_label_new(text);
			GtkWidget *image = gtk_image_new_from_stock(id,
					gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL));
			GtkWidget *ebox = gtk_event_box_new();
			gtk_container_add(GTK_CONTAINER(ebox), image);
			gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

			g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(change_stock_image), image);
			g_object_set_data(G_OBJECT(image), "property-name", (gpointer)id);
			g_object_set_data(G_OBJECT(image), "localized-name", (gpointer)text);

			gtk_size_group_add_widget(sizegroup, label);
			gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
			gtk_box_pack_start(GTK_BOX(hbox), ebox, FALSE, FALSE, 0);

			for (j = 0; stocksizes[j]; j++) {
				GtkWidget *sh;

				if (!(sections[s].flags & (1 << j)))
					continue;

				sh = gtk_image_new_from_stock(id, gtk_icon_size_from_name(stocksizes[j]));
				gtk_box_pack_start(GTK_BOX(hbox), sh, FALSE, FALSE, 0);
				g_object_set_data(G_OBJECT(image), stocksizes[j], sh);
			}

			gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

			g_object_set_data(G_OBJECT(vbox), id, image);
		}
	}

#ifdef NOT_SADRUL
	pidgin_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_SAVE, G_CALLBACK(save_icon_theme), dialog);
#endif
	pidgin_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_APPLY, G_CALLBACK(use_icon_theme), dialog);
	pidgin_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, G_CALLBACK(close_icon_theme), dialog);
	gtk_widget_show_all(dialog);
	g_object_unref(sizegroup);
}
Ejemplo n.º 2
0
PidginXferDialog *
pidgin_xfer_dialog_new(void)
{
	PidginXferDialog *dialog;
	GtkWidget *window;
	GtkWidget *vbox1, *vbox2;
	GtkWidget *sw;
	GtkWidget *button;
	GtkWidget *expander;
	GtkWidget *table;
	GtkWidget *checkbox;

	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");

	/* Create the window. */
	dialog->window = window = pidgin_create_dialog(_("File Transfers"), PIDGIN_HIG_BORDER, "file transfer", TRUE);

	g_signal_connect(G_OBJECT(window), "delete_event",
					 G_CALLBACK(delete_win_cb), dialog);

	/* Create the parent vbox for everything. */
	vbox1 = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(window), FALSE, PIDGIN_HIG_BORDER);

	/* Create the main vbox for top half of the window. */
	vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
	gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0);
	gtk_widget_show(vbox2);

	/* Setup the listbox */
	sw = setup_tree(dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0);
	gtk_widget_set_size_request(sw,-1, 140);

	/* "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(vbox2), checkbox, FALSE, FALSE, 0);
	gtk_widget_show(checkbox);

	/* "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(vbox2), 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(vbox2), expander, FALSE, FALSE, 0);
	gtk_widget_show(expander);

	gtk_widget_set_sensitive(expander, FALSE);

	/* The table of information. */
	table = make_info_table(dialog);
	gtk_container_add(GTK_CONTAINER(expander), table);
	gtk_widget_show(table);

	/* Open button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_OPEN, G_CALLBACK(open_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->open_button = button;

	/* Pause button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), _("_Pause"), G_CALLBACK(pause_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->pause_button = button;

	/* Resume button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), _("_Resume"), G_CALLBACK(resume_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->resume_button = button;

	/* Remove button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_REMOVE, G_CALLBACK(remove_button_cb), dialog);
	gtk_widget_hide(button);
	dialog->remove_button = button;

	/* Stop button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP, G_CALLBACK(stop_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->stop_button = button;

	/* Close button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, G_CALLBACK(close_button_cb), dialog);
	dialog->close_button = button;

#ifdef _WIN32
	g_signal_connect(G_OBJECT(dialog->window), "show",
		G_CALLBACK(winpidgin_ensure_onscreen), dialog->window);
#endif

	return dialog;
}