static GtkWidget* get_config_frame(PurplePlugin *plugin) { GtkWidget *ret; GtkWidget *vbox; GtkWidget *button; char *gtk_version = NULL; char *run_key_val; char *tmp; ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(ret), 12); gtk_version = g_strdup_printf("GTK+\t%u.%u.%u\nGlib\t%u.%u.%u", gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version); /* Display Installed GTK+ Runtime Version */ if(gtk_version) { GtkWidget *label; vbox = pidgin_make_frame(ret, _("GTK+ Runtime Version")); label = gtk_label_new(gtk_version); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); gtk_widget_show(label); g_free(gtk_version); } /* Autostart */ vbox = pidgin_make_frame(ret, _("Startup")); tmp = g_strdup_printf(_("_Start %s on Windows startup"), PIDGIN_NAME); button = gtk_check_button_new_with_mnemonic(tmp); g_free(tmp); gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); if ((run_key_val = wpurple_read_reg_string(HKEY_CURRENT_USER, RUNKEY, "Pidgin")) || (run_key_val = wpurple_read_reg_string(HKEY_LOCAL_MACHINE, RUNKEY, "Pidgin"))) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); g_free(run_key_val); } g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(winprefs_set_autostart), NULL); gtk_widget_show(button); /* Buddy List */ vbox = pidgin_make_frame(ret, _("Buddy List")); pidgin_prefs_checkbox(_("_Dockable Buddy List"), PREF_DBLIST_DOCKABLE, vbox); /* Blist On Top */ pidgin_prefs_dropdown(vbox, _("_Keep Buddy List window on top:"), PURPLE_PREF_INT, PREF_BLIST_ON_TOP, _("Never"), BLIST_TOP_NEVER, _("Always"), BLIST_TOP_ALWAYS, /* XXX: Did this ever work? */ _("Only when docked"), BLIST_TOP_DOCKED, NULL); gtk_widget_show_all(ret); return ret; }
static GtkWidget *plugin_config_frame(PurplePlugin *plugin) { GtkWidget *frame; GtkWidget *vbox, *vbox2; GtkSizeGroup *sg; GtkWidget *dd; frame = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(frame), 12); vbox = pidgin_make_frame(frame, "Inform about unread..."); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); dd = pidgin_prefs_dropdown(vbox, "LED:", PURPLE_PREF_STRING, "/plugins/gtk/ftdi-hwnotify/led-one", "None", "none", "Blue", "blue", "Red", "red", "Green", "green", NULL); gtk_size_group_add_widget(sg, dd); dd = pidgin_prefs_dropdown(vbox, "Instant Messages:", PURPLE_PREF_STRING, "/plugins/gtk/ftdi-hwnotify/im", "Never", "never", "In hidden conversations", "hidden", "Always", "always", NULL); gtk_size_group_add_widget(sg, dd); dd = pidgin_prefs_dropdown(vbox, "Chat Messages:", PURPLE_PREF_STRING, "/plugins/gtk/ftdi-hwnotify/chat", "Never", "never", "When my nick is said", "nick", "Always", "always", NULL); gtk_size_group_add_widget(sg, dd); vbox2 = pidgin_make_frame(frame, "Important contacts..."); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); dd = pidgin_prefs_dropdown(vbox2, "LED:", PURPLE_PREF_STRING, "/plugins/gtk/ftdi-hwnotify/led-imp", "None", "none", "Blue", "blue", "Red", "red", "Green", "green", NULL); gtk_size_group_add_widget(sg, dd); pidgin_prefs_labeled_entry (vbox2, "Contacts:", "/plugins/gtk/ftdi-hwnotify/contacts-imp", sg); gtk_widget_show_all(frame); return frame; }
static GtkWidget * get_config_frame(PurplePlugin *plugin) { GtkWidget *ret; GtkWidget *frame, *label; GtkWidget *vbox, *hbox; GtkObject *adj; GtkWidget *spinner; ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width (GTK_CONTAINER (ret), 12); frame = pidgin_make_frame(ret, _("Display Timestamps Every")); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); /* XXX limit to divisors of 60? */ adj = gtk_adjustment_new(interval / 60, 1, 60, 1, 0, 0); spinner = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0, 0); gtk_box_pack_start(GTK_BOX(hbox), spinner, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(spinner), "value-changed", G_CALLBACK(set_timestamp), NULL); label = gtk_label_new(_("minutes")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); gtk_widget_show_all(ret); return ret; }
static GtkWidget * get_config_frame(PurplePlugin *plugin) { GtkWidget *ret; GtkWidget *vbox; GtkWidget *editor_path; GtkWidget *editor_path_label; GtkWidget *editor_path_button; /* Outside container */ ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(ret), 10); /* Configuration frame */ vbox = pidgin_make_frame(ret, _("Music Messaging Configuration")); /* Path to the score editor */ editor_path = gtk_entry_new(); editor_path_label = gtk_label_new(_("Score Editor Path")); editor_path_button = gtk_button_new_with_mnemonic(_("_Apply")); gtk_entry_set_text((GtkEntry*)editor_path, "/usr/local/bin/gscore"); g_signal_connect(G_OBJECT(editor_path_button), "clicked", G_CALLBACK(set_editor_path), editor_path); gtk_box_pack_start(GTK_BOX(vbox), editor_path_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), editor_path, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), editor_path_button, FALSE, FALSE, 0); gtk_widget_show_all(ret); return ret; }
static GtkWidget * plonkers_get_config_frame(PurplePlugin *plugin) { GtkWidget *vbox, *hbox, *frame, *label; GtkSizeGroup *sg; vbox = gtk_vbox_new(FALSE, 6); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); frame = pidgin_make_frame(vbox, _("Ignored Plonkers")); pidgin_prefs_labeled_entry(frame, _("Plonkers singular format:"), "/plugins/core/plugin_pack/plonkers/plonkers/format_singular", NULL); pidgin_prefs_labeled_entry(frame, _("Plonkers plural format:"), "/plugins/core/plugin_pack/plonkers/plonkers/format_plural", NULL); frame = pidgin_make_frame(vbox, _("Plonking")); pidgin_prefs_labeled_entry(frame, _("Plonked singular plural:"), "/plugins/core/plugin_pack/plonkers/plonked/format_singular", NULL); pidgin_prefs_labeled_entry(frame, _("Plonked plural format:"), "/plugins/core/plugin_pack/plonkers/plonked/format_plural", NULL); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); frame = pidgin_make_frame(vbox, _("Format information")); hbox = gtk_hbox_new(FALSE, 6); gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); label = plonkers_make_label(_("%P: List of plonkers"), sg); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); label = plonkers_make_label(_("%N: Number of plonkers"), NULL); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_widget_show_all(vbox); return vbox; }
static GtkWidget *plugin_config_frame(PurplePlugin *plugin) { GtkWidget *frame; GtkWidget *vbox; GtkWidget *vbox2; GtkSizeGroup *sg; GtkWidget *dd; GtkWidget *ent; frame = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(frame), 12); vbox = pidgin_make_frame(frame, "Inform about unread..."); vbox2 = pidgin_make_frame(frame, "Hardware setup:"); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); dd = pidgin_prefs_dropdown(vbox, "Instant Messages:", PURPLE_PREF_STRING, "/plugins/gtk/gtk-sarah-barnot/im", "Never", "never", "In hidden conversations", "hidden", "Always", "always", NULL); gtk_size_group_add_widget(sg, dd); dd = pidgin_prefs_dropdown(vbox, "Chat Messages:", PURPLE_PREF_STRING, "/plugins/gtk/gtk-sarah-barnot/chat", "Never", "never", "When my nick is said", "nick", "Always", "always", NULL); gtk_size_group_add_widget(sg, dd); ent=pidgin_prefs_labeled_entry(vbox2,"File to be displayed on xmobar:", "/plugins/gtk/gtk-sarah-barnot/filename",sg); gtk_widget_show_all(frame); return frame; }
static GtkWidget * get_config_frame(PurplePlugin *plugin) { GtkWidget *ret; GtkWidget *vbox; GtkWidget *toggle; #if 0 GtkWidget *opt; GtkWidget *menu, *item; #endif /* Outside container */ ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(ret), 12); /* Configuration frame */ vbox = pidgin_make_frame(ret, _("Mouse Gestures Configuration")); #if 0 /* Mouse button drop-down menu */ menu = gtk_menu_new(); opt = gtk_option_menu_new(); item = gtk_menu_item_new_with_label(_("Middle mouse button")); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(mouse_button_menu_cb), opt); gtk_menu_append(menu, item); item = gtk_menu_item_new_with_label(_("Right mouse button")); g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(mouse_button_menu_cb), opt); gtk_menu_append(menu, item); gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu); gtk_option_menu_set_history(GTK_OPTION_MENU(opt), gstroke_get_mouse_button() - 2); #endif /* "Visual gesture display" checkbox */ toggle = gtk_check_button_new_with_mnemonic(_("_Visual gesture display")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/gestures/visual")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(toggle_draw_cb), NULL); gtk_widget_show_all(ret); return ret; }
static GtkWidget * eh_prefs_get_frame(PurplePlugin *plugin) { GtkSizeGroup *sg = NULL; GtkWidget *vbox = NULL, *frame = NULL, *option = NULL; sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); vbox = gtk_vbox_new(TRUE, PIDGIN_HIG_BOX_SPACE); /* heading for the more general options */ frame = pidgin_make_frame(vbox, _("Display Options")); /* the integer pref for the number of logs to display */ pidgin_prefs_labeled_spin_button(frame, _("Maximum number of conversations:"), PREF_NUMBER_PATH, 0, 255, NULL); /* the integer pref for maximum number of bytes to read back */ pidgin_prefs_labeled_spin_button(frame, _("Maximum number of bytes:"), PREF_BYTES_PATH, 0, 1024*1024, NULL); /* the boolean preferences */ option = pidgin_prefs_checkbox(_("Show dates with text"), PREF_DATES_PATH, frame); option = pidgin_prefs_checkbox(_("Show logs for IMs"), PREF_IM_PATH, frame); option = pidgin_prefs_checkbox(_("Show logs for chats"), PREF_CHAT_PATH, frame); /* heading for the age limit options */ frame = pidgin_make_frame(vbox, _("Age Limit for Logs (0 to disable):")); /* the integer preferences for time limiting */ option = pidgin_prefs_labeled_spin_button(frame, "Days:", PREF_DAYS_PATH, 0, 255, sg); option = pidgin_prefs_labeled_spin_button(frame, "Hours:", PREF_HOURS_PATH, 0, 255, sg); option = pidgin_prefs_labeled_spin_button(frame, "Minutes:", PREF_MINS_PATH, 0, 255, sg); gtk_widget_show_all(vbox); return vbox; }
static GtkWidget *plugin_config_frame(PurplePlugin *plugin) { GtkWidget *frame; GtkWidget *vbox; GtkSizeGroup *sg; frame = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(frame), 12); vbox = pidgin_make_frame(frame, "Server settings..."); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); pidgin_prefs_labeled_entry(vbox, "IP", "/plugins/gtk/"PLUGIN_ID"/ip", sg); pidgin_prefs_labeled_entry(vbox, "Port", "/plugins/gtk/"PLUGIN_ID"/port", sg); pidgin_prefs_labeled_entry(vbox, "Mod", "/plugins/gtk/"PLUGIN_ID"/mod", sg); pidgin_prefs_labeled_entry(vbox, "Topic", "/plugins/gtk/"PLUGIN_ID"/topic", sg); gtk_widget_show_all(frame); return frame; }
static void get_plugin_frame(GtkWidget *parent, GtkSizeGroup *sg, const gchar *name, const gchar *plugin_label, const gchar **plugin_strs, const gchar *plugin_pref, const gchar *device_label, const gchar *device_pref) { GtkWidget *vbox, *widget; GList *plugins, *devices; vbox = pidgin_make_frame(parent, name); /* Setup plugin preference */ plugins = get_element_plugins(plugin_strs); widget = pidgin_prefs_dropdown_from_list(vbox, plugin_label, PURPLE_PREF_STRING, plugin_pref, plugins); g_list_free(plugins); gtk_size_group_add_widget(sg, widget); gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5); /* Setup device preference */ devices = get_element_devices(purple_prefs_get_string(plugin_pref)); if (g_list_find_custom(devices, purple_prefs_get_string(device_pref), (GCompareFunc) strcmp) == NULL) purple_prefs_set_string(device_pref, g_list_next(devices)->data); widget = pidgin_prefs_dropdown_from_list(vbox, device_label, PURPLE_PREF_STRING, device_pref, devices); g_list_free(devices); gtk_widget_set_name(widget, plugin_pref); gtk_size_group_add_widget(sg, widget); gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5); purple_prefs_connect_callback(vbox, plugin_pref, device_changed_cb, sg); g_signal_connect_swapped(vbox, "destroy", G_CALLBACK(purple_prefs_disconnect_by_handle), vbox); }
static GtkWidget *get_config_frame(PurplePlugin *plugin) { GtkWidget *ret; GtkWidget *frame; GtkWidget *vbox, *hbox; GtkWidget *drawing_area; GtkWidget *label; GtkAdjustment *adj; GtkWidget *spinner; GtkWidget *button, *button1, *button2; GSList *group; struct draw_info *info; struct crazychat *cc; cc = (struct crazychat*)plugin->info->extra_info; assert(cc); /* create widgets */ /* creating the config frame */ ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(ret), 12); /* make the network configuration frame */ frame = pidgin_make_frame(ret, _("Network Configuration")); gtk_widget_show(frame); /* add boxes for packing purposes */ vbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(frame), vbox, TRUE, TRUE, 0); gtk_widget_show(vbox); /* add widgets to row 1 */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); label = gtk_label_new(_("TCP port")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 15); gtk_widget_show(label); adj = (GtkAdjustment*)gtk_adjustment_new(DEFAULT_CC_PORT, 1, G_MAXUSHORT, 1, 1000, 0); spinner = gtk_spin_button_new(adj, 1, 0); g_signal_connect(G_OBJECT(spinner), "value_changed", G_CALLBACK(tcp_port_cb), cc); gtk_box_pack_start(GTK_BOX(hbox), spinner, FALSE, FALSE, 0); gtk_widget_show(spinner); label = gtk_label_new(_("UDP port")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 15); gtk_widget_show(label); adj = (GtkAdjustment*)gtk_adjustment_new(DEFAULT_CC_PORT, 1, G_MAXUSHORT, 1, 1000, 0); spinner = gtk_spin_button_new(adj, 1, 0); g_signal_connect(G_OBJECT(spinner), "value_changed", G_CALLBACK(udp_port_cb), cc); gtk_box_pack_start(GTK_BOX(hbox), spinner, FALSE, FALSE, 0); gtk_widget_show(spinner); /* make the feature configuration frame */ frame = pidgin_make_frame(ret, _("Feature Calibration")); gtk_widget_show(frame); /* add hbox for packing purposes */ hbox = gtk_hbox_new(TRUE, 40); gtk_box_pack_start(GTK_BOX(frame), hbox, TRUE, TRUE, 0); gtk_widget_show(hbox); /* add feature calibration options */ /* add vbox for packing purposes */ vbox = gtk_vbox_new(TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); gtk_widget_show(vbox); /* add enabled / disabled */ button1 = gtk_radio_button_new_with_label(NULL, _("Enabled")); gtk_box_pack_start(GTK_BOX(vbox), button1, TRUE, TRUE, 0); gtk_widget_show(button1); group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button1)); button2 = gtk_radio_button_new_with_label(group, _("Disabled")); gtk_box_pack_start(GTK_BOX(vbox), button2, TRUE, TRUE, 0); gtk_widget_show(button2); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button1), cc->features_state); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button2), !cc->features_state); g_signal_connect_swapped(G_OBJECT(button1), "toggled", G_CALLBACK(features_enable_cb), cc); /* add vbox for packing purposes */ vbox = gtk_vbox_new(TRUE, 0); gtk_box_pack_end(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); gtk_widget_show(vbox); /* add calibrate button */ button = gtk_button_new_with_label("Calibrate"); gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, FALSE, 0); gtk_widget_show(button); gtk_widget_show(ret); return ret; }
static GtkWidget * purplerc_get_config_frame(PurplePlugin *plugin) { gchar *tmp; GtkWidget *check = NULL, *label = NULL; GtkWidget *ret = NULL, *hbox = NULL, *frame = NULL, *note = NULL; #ifndef _WIN32 const gchar *homepath = "$HOME"; #else const gchar *homepath = "\%APPDATA\%"; #endif ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); note = gtk_notebook_new(); label = gtk_label_new(NULL); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); tmp = g_strdup_printf("<span weight=\"bold\">%s</span>", _("GTK+ Theme Control Settings")); gtk_label_set_markup(GTK_LABEL(label), tmp); g_free(tmp); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(ret), note, FALSE, FALSE, 0); label = gtk_label_new(_("Colors")); gtk_notebook_insert_page(GTK_NOTEBOOK(note), purplerc_make_interface_vbox(), label, -1); label = gtk_label_new(_("Fonts")); gtk_notebook_insert_page(GTK_NOTEBOOK(note), purplerc_make_fonts_vbox(), label, -1); label = gtk_label_new(_("Miscellaneous")); gtk_notebook_insert_page(GTK_NOTEBOOK(note), purplerc_make_misc_vbox(), label, -1); gtk_box_pack_start(GTK_BOX(ret), gtk_hseparator_new(), TRUE, TRUE, 0); frame = pidgin_make_frame(ret, _("Gtkrc File Tools")); hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); gtk_box_pack_start(GTK_BOX(frame), hbox, FALSE, FALSE, 0); tmp = g_strdup_printf(_("Write settings to %s%sgtkrc-2.0"), homepath, G_DIR_SEPARATOR_S ".purple" G_DIR_SEPARATOR_S); check = gtk_button_new_with_label(tmp); g_free(tmp); gtk_box_pack_start(GTK_BOX(hbox), check, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(check), "clicked", G_CALLBACK(purplerc_write), NULL); check = gtk_button_new_with_label(_("Re-read gtkrc files")); gtk_box_pack_start(GTK_BOX(hbox), check, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(check), "clicked", G_CALLBACK(purplerc_reread), NULL); gtk_widget_show_all(ret); return ret; }
static GtkWidget * get_config_frame(PurplePlugin *plugin) { GtkWidget *ret = NULL, *hbox = NULL, *frame = NULL, *vbox = NULL; GtkWidget *label = NULL, *spin = NULL, *check = NULL; GtkWidget *optmenu = NULL; GtkObject *adj = NULL; GtkSizeGroup *sg = NULL; PurpleAccount *account = NULL; int i; gboolean last_match = purple_prefs_get_bool("/purple/contact/last_match"); sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(ret), 12); frame = pidgin_make_frame(ret, _("Point values to use when...")); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); /* Status Spinboxes */ for (i = 0 ; statuses[i].id != NULL && statuses[i].description != NULL ; i++) { char *pref = g_strconcat("/purple/status/scores/", statuses[i].id, NULL); hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic(_(statuses[i].description)); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_size_group_add_widget(sg, label); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); adj = gtk_adjustment_new(purple_prefs_get_int(pref), -500, 500, 1, 1, 1); spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0); g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(pref_update), pref); gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); g_free(pref); } /* Explanation */ label = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(label), _("The buddy with the <i>largest score</i> is the buddy who will have priority in the contact.\n")); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); /* Last match */ hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); check = gtk_check_button_new_with_label(_("Use last buddy when scores are equal")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), last_match); g_signal_connect(G_OBJECT(check), "toggled", G_CALLBACK(pref_update), "/purple/contact/last_match"); gtk_box_pack_start(GTK_BOX(hbox), check, FALSE, FALSE, 0); frame = pidgin_make_frame(ret, _("Point values to use for account...")); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); /* Account */ hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); /* make this here so I can use it in the option menu callback, we'll * actually set it up later */ adj = gtk_adjustment_new(0, -500, 500, 1, 1, 1); spin = gtk_spin_button_new((GtkAdjustment *)adj, 1, 0); optmenu = pidgin_account_option_menu_new(NULL, TRUE, G_CALLBACK(select_account), NULL, spin); gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 0); /* this is where we set up the spin button we made above */ account = g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu))))), "account"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), (gdouble)purple_account_get_int(account, "score", 0)); gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(spin), GTK_ADJUSTMENT(adj)); g_signal_connect(G_OBJECT(spin), "value-changed", G_CALLBACK(account_update), optmenu); gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); gtk_widget_show_all(ret); g_object_unref(sg); return ret; }
static CapPrefsUI * create_cap_prefs_ui() { CapPrefsUI *ui = g_malloc(sizeof(CapPrefsUI)); ui->ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER(ui->ret), 10); ui->cap_vbox = pidgin_make_frame(ui->ret, _("Statistics Configuration")); /* msg_difference spinner */ ui->msg_difference_label = gtk_label_new(_("Maximum response timeout:")); gtk_misc_set_alignment(GTK_MISC(ui->msg_difference_label), 0, 0.5); ui->msg_difference_input = gtk_spin_button_new_with_range(1, 1440, 1); ui->msg_difference_minutes_label = gtk_label_new(_("minutes")); gtk_misc_set_alignment(GTK_MISC(ui->msg_difference_minutes_label), 0, 0.5); /* last_seen spinner */ ui->last_seen_label = gtk_label_new(_("Maximum last-seen difference:")); gtk_misc_set_alignment(GTK_MISC(ui->last_seen_label), 0, 0.5); ui->last_seen_input = gtk_spin_button_new_with_range(1, 1440, 1); ui->last_seen_minutes_label = gtk_label_new(_("minutes")); gtk_misc_set_alignment(GTK_MISC(ui->last_seen_minutes_label), 0, 0.5); /* threshold spinner */ ui->threshold_label = gtk_label_new(_("Threshold:")); gtk_misc_set_alignment(GTK_MISC(ui->threshold_label), 0, 0.5); ui->threshold_input = gtk_spin_button_new_with_range(1, 1440, 1); ui->threshold_minutes_label = gtk_label_new(_("minutes")); gtk_misc_set_alignment(GTK_MISC(ui->threshold_minutes_label), 0, 0.5); /* Layout threshold/last-seen/response-timeout input items */ ui->table_layout = gtk_table_new(3, 3, FALSE); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->threshold_label, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->threshold_input, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->threshold_minutes_label, 2, 3, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->msg_difference_label, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->msg_difference_input, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->msg_difference_minutes_label, 2, 3, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->last_seen_label, 0, 1, 2,3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->last_seen_input, 1, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_table_attach(GTK_TABLE(ui->table_layout), ui->last_seen_minutes_label, 2, 3, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); /* Config window - lay it out */ gtk_box_pack_start(GTK_BOX(ui->cap_vbox), ui->table_layout, FALSE, FALSE, 0); /* Set the input areas to contain the configuration values from * purple prefs. */ if(purple_prefs_exists("/plugins/gtk/cap/max_msg_difference")) { int max_msg_diff = purple_prefs_get_int("/plugins/gtk/cap/max_msg_difference"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->msg_difference_input), max_msg_diff); } if(purple_prefs_exists("/plugins/gtk/cap/max_seen_difference")) { int max_seen_diff = purple_prefs_get_int("/plugins/gtk/cap/max_seen_difference"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->last_seen_input), max_seen_diff); } if(purple_prefs_exists("/plugins/gtk/cap/threshold")) { int threshold = purple_prefs_get_int("/plugins/gtk/cap/threshold"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->threshold_input), threshold); } /* Add the signals */ g_signal_connect(G_OBJECT(ui->ret), "destroy", G_CALLBACK(cap_prefs_ui_destroy_cb), ui); g_signal_connect(G_OBJECT(ui->msg_difference_input), "value-changed", G_CALLBACK(numeric_spinner_prefs_cb), "/plugins/gtk/cap/max_msg_difference"); g_signal_connect(G_OBJECT(ui->last_seen_input), "value-changed", G_CALLBACK(numeric_spinner_prefs_cb), "/plugins/gtk/cap/max_seen_difference"); g_signal_connect(G_OBJECT(ui->threshold_input), "value-changed", G_CALLBACK(numeric_spinner_prefs_cb), "/plugins/gtk/cap/threshold"); return ui; }
static GtkWidget * get_config_frame(PurplePlugin *plugin) { GtkWidget *ret = NULL, *frame = NULL; GtkWidget *vbox = NULL, *hbox = NULL; GtkWidget *toggle = NULL, *entry = NULL, *ref; ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER (ret), 12); /*---------- "Notify For" ----------*/ frame = pidgin_make_frame(ret, _("Notify For")); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(type_toggle_cb), "type_im"); toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(type_toggle_cb), "type_chat"); ref = toggle; toggle = gtk_check_button_new_with_mnemonic(_("\t_Only when someone says your username")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_nick")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(type_toggle_cb), "type_chat_nick"); gtk_widget_set_sensitive(toggle, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ref))); g_signal_connect(G_OBJECT(ref), "toggled", G_CALLBACK(pidgin_toggle_sensitive), toggle); toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(type_toggle_cb), "type_focused"); /*---------- "Notification Methods" ----------*/ frame = pidgin_make_frame(ret, _("Notification Methods")); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); /* String method button */ hbox = gtk_hbox_new(FALSE, 18); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); entry = gtk_entry_new(); gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); gtk_entry_set_max_length(GTK_ENTRY(entry), 10); gtk_widget_set_sensitive(GTK_WIDGET(entry), purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); gtk_entry_set_text(GTK_ENTRY(entry), purple_prefs_get_string("/plugins/gtk/X11/notify/title_string")); g_object_set_data(G_OBJECT(toggle), "title-entry", entry); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(method_toggle_cb), "method_string"); g_signal_connect(G_OBJECT(entry), "focus-out-event", G_CALLBACK(options_entry_cb), "method_string"); /* Count method button */ toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(method_toggle_cb), "method_count"); #ifndef _WIN32 /* Count xprop method button */ toggle = gtk_check_button_new_with_mnemonic(_("Insert count of new message into _X property")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count_xprop")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(method_toggle_cb), "method_count_xprop"); /* Urgent method button */ toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint")); #else toggle = gtk_check_button_new_with_mnemonic(_("_Flash window")); #endif gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(method_toggle_cb), "method_urgent"); /* Raise window method button */ toggle = gtk_check_button_new_with_mnemonic(_("R_aise conversation window")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(method_toggle_cb), "method_raise"); /* Present conversation method button */ toggle = gtk_check_button_new_with_mnemonic(_("_Present conversation window")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/method_present")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(method_toggle_cb), "method_present"); /*---------- "Notification Removals" ----------*/ frame = pidgin_make_frame(ret, _("Notification Removal")); vbox = gtk_vbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); /* Remove on focus button */ toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); /* Remove on click button */ toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_click"); /* Remove on type button */ toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_type"); /* Remove on message send button */ toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_send"); #if 0 /* Remove on conversation switch button */ toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_switch"); #endif gtk_widget_show_all(ret); return ret; }
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); }
static GtkWidget * get_config_frame(PurplePlugin *plugin) { GtkWidget *ret = NULL, *frame = NULL; GtkWidget *vbox = NULL, *toggle = NULL; ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18); gtk_container_set_border_width(GTK_CONTAINER (ret), 12); /* Alerts */ frame = pidgin_make_frame(ret, _("Chatroom alerts")); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); toggle = gtk_check_button_new_with_mnemonic(_("Chatroom message alerts _only where someone says your username")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_bool("/plugins/gtk/unity/alert_chat_nick")); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(alert_config_cb), NULL); /* Launcher integration */ frame = pidgin_make_frame(ret, _("Launcher Icon")); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); toggle = gtk_radio_button_new_with_mnemonic(NULL, _("_Disable launcher integration")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_int("/plugins/gtk/unity/launcher_count") == LAUNCHER_COUNT_DISABLE); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(launcher_config_cb), GUINT_TO_POINTER(LAUNCHER_COUNT_DISABLE)); toggle = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(toggle), _("Show number of unread _messages on launcher icon")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_int("/plugins/gtk/unity/launcher_count") == LAUNCHER_COUNT_MESSAGES); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(launcher_config_cb), GUINT_TO_POINTER(LAUNCHER_COUNT_MESSAGES)); toggle = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(toggle), _("Show number of unread co_nversations on launcher icon")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_int("/plugins/gtk/unity/launcher_count") == LAUNCHER_COUNT_SOURCES); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(launcher_config_cb), GUINT_TO_POINTER(LAUNCHER_COUNT_SOURCES)); /* Messaging menu integration */ frame = pidgin_make_frame(ret, _("Messaging Menu")); vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); gtk_container_add(GTK_CONTAINER(frame), vbox); toggle = gtk_radio_button_new_with_mnemonic(NULL, _("Show number of _unread messages for conversations in messaging menu")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_int("/plugins/gtk/unity/messaging_menu_text") == MESSAGING_MENU_COUNT); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(messaging_menu_config_cb), GUINT_TO_POINTER(MESSAGING_MENU_COUNT)); toggle = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(toggle), _("Show _elapsed time for unread conversations in messaging menu")); gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), purple_prefs_get_int("/plugins/gtk/unity/messaging_menu_text") == MESSAGING_MENU_TIME); g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(messaging_menu_config_cb), GUINT_TO_POINTER(MESSAGING_MENU_TIME)); gtk_widget_show_all(ret); return ret; }
static GtkWidget *get_autoreply_page () { GtkWidget *page; GtkWidget *label, *checkbox, *spinner, *entry; GtkWidget *frame, *vbox, *large_vbox, *hbox; GtkWidget *dd; GtkSizeGroup *sg; /* Make the box */ page = gtk_vbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER (page), 12); frame = pidgin_make_frame(page, _("General")); dd = pidgin_prefs_dropdown(frame, _("Auto-reply:"), PURPLE_PREF_STRING, "/plugins/gtk/autoprofile/autorespond/auto_reply", _("Never"), "never", _("When away"), "away", _("When both away and idle"), "awayidle", NULL); sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); gtk_size_group_add_widget(sg, dd); gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); /*---------- Auto-responses ----------*/ frame = pidgin_make_frame (page, _("Dynamic auto-responses")); vbox = gtk_vbox_new (FALSE, 5); gtk_container_add (GTK_CONTAINER (frame), vbox); /* Auto-response activated */ checkbox = pidgin_prefs_checkbox ( _("Allow users to request more auto-responses"), "/plugins/gtk/autoprofile/autorespond/enable", vbox); large_vbox = gtk_vbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (vbox), large_vbox, FALSE, FALSE, 0); /* Auto-response delay */ hbox = gtk_hbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (large_vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new (_("Delay")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); spinner = gtk_spin_button_new_with_range (1, G_MAXINT, 1); gtk_box_pack_start (GTK_BOX (hbox), spinner, TRUE, TRUE, 0); label = gtk_label_new (_("seconds between auto-responses")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinner), purple_prefs_get_int ( "/plugins/gtk/autoprofile/autorespond/delay")); g_signal_connect (G_OBJECT (spinner), "value-changed", G_CALLBACK (update_delay_respond), NULL); /* Auto-response message string */ label = gtk_label_new (_("Message sent with first autoresponse:")); gtk_box_pack_start (GTK_BOX (large_vbox), label, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (large_vbox), entry, FALSE, FALSE, 0); gtk_entry_set_max_length (GTK_ENTRY (entry), 100); gtk_entry_set_text (GTK_ENTRY (entry), purple_prefs_get_string ( "/plugins/gtk/autoprofile/autorespond/text")); g_signal_connect (G_OBJECT (entry), "focus-out-event", G_CALLBACK (update_behavior_string), "text_respond"); label = gtk_label_new (_("Request trigger message:")); gtk_box_pack_start (GTK_BOX (large_vbox), label, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (label), 0, 0); entry = gtk_entry_new (); gtk_box_pack_start (GTK_BOX (large_vbox), entry, FALSE, FALSE, 0); gtk_entry_set_max_length (GTK_ENTRY (entry), 50); gtk_entry_set_text (GTK_ENTRY (entry), purple_prefs_get_string ( "/plugins/gtk/autoprofile/autorespond/trigger")); g_signal_connect (G_OBJECT (entry), "focus-out-event", G_CALLBACK (update_behavior_string), "text_trigger"); /* Sensitivity signals */ g_signal_connect(G_OBJECT(checkbox), "clicked", G_CALLBACK(pidgin_toggle_sensitive), large_vbox); if (!purple_prefs_get_bool ("/plugins/gtk/autoprofile/autorespond/enable")) { gtk_widget_set_sensitive (large_vbox, FALSE); } else { gtk_widget_set_sensitive (large_vbox, TRUE); } return page; }
static GtkWidget *get_behavior_page () { GtkWidget *page; GtkWidget *label; GtkWidget *frame, *vbox, *hbox; GtkWidget *button, *select, *menu; GtkSizeGroup *sg; gchar *markup; /* Make the box */ page = gtk_vbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER (page), 12); /*---------- Update frequency ----------*/ frame = pidgin_make_frame (page, _("Update frequency")); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (frame), vbox); pidgin_prefs_labeled_spin_button (vbox, _("Minimum number of seconds between updates"), "/plugins/gtk/autoprofile/delay_update", 15, 1000, NULL); label = gtk_label_new (""); markup = g_markup_printf_escaped ("<span style=\"italic\">%s</span>", _("WARNING: Using values below 60 seconds may increase the frequency\n" "of rate limiting errors")); gtk_label_set_markup (GTK_LABEL (label), markup); g_free (markup); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); /*----------- Auto-away stuff ------------*/ frame = pidgin_make_frame(page, _("Auto-away")); button = pidgin_prefs_checkbox(_("Change status when idle"), "/plugins/gtk/autoprofile/away_when_idle", frame); sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); select = pidgin_prefs_labeled_spin_button(frame, _("Minutes before changing status:"), "/core/away/mins_before_away", 1, 24 * 60, sg); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), select); hbox = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame), hbox); label = gtk_label_new_with_mnemonic(_("Change status to:")); gtk_size_group_add_widget(sg, label); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); /* 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_box_pack_start(GTK_BOX(frame), menu, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), menu); gtk_label_set_mnemonic_widget(GTK_LABEL(label), menu); if (!purple_prefs_get_bool("/plugins/gtk/autoprofile/away_when_idle")) { gtk_widget_set_sensitive(GTK_WIDGET(menu), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); } return page; }
static GtkWidget *get_config_frame(PurplePlugin *plugin) { GtkWidget *ret; GtkWidget *imtransbox, *bltransbox; GtkWidget *hbox; GtkWidget *label, *slider; GtkWidget *button; GtkWidget *trans_box; ret = gtk_vbox_new(FALSE, 18); gtk_container_set_border_width(GTK_CONTAINER (ret), 12); /* IM Convo trans options */ imtransbox = pidgin_make_frame(ret, _("IM Conversation Windows")); button = pidgin_prefs_checkbox(_("_IM window transparency"), OPT_WINTRANS_IM_ENABLED, imtransbox); g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(update_convs_wintrans), (gpointer) OPT_WINTRANS_IM_ENABLED); trans_box = gtk_vbox_new(FALSE, 18); if (!purple_prefs_get_bool(OPT_WINTRANS_IM_ENABLED)) gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); gtk_widget_show(trans_box); g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), trans_box); button = pidgin_prefs_checkbox(_("_Show slider bar in IM window"), OPT_WINTRANS_IM_SLIDER, trans_box); g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(update_convs_wintrans), (gpointer) OPT_WINTRANS_IM_SLIDER); button = pidgin_prefs_checkbox( _("Remove IM window transparency on focus"), OPT_WINTRANS_IM_ONFOCUS, trans_box); button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_IM_ONTOP, trans_box); g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(update_convs_wintrans), (gpointer) OPT_WINTRANS_IM_ONTOP); gtk_box_pack_start(GTK_BOX(imtransbox), trans_box, FALSE, FALSE, 5); /* IM transparency slider */ hbox = gtk_hbox_new(FALSE, 5); label = gtk_label_new(_("Opacity:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); slider = gtk_hscale_new_with_range(50, 255, 1); gtk_range_set_value(GTK_RANGE(slider), purple_prefs_get_int(OPT_WINTRANS_IM_ALPHA)); gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); g_signal_connect(GTK_OBJECT(slider), "value-changed", G_CALLBACK(alpha_change), NULL); g_signal_connect(GTK_OBJECT(slider), "focus-out-event", G_CALLBACK(alpha_pref_set_int), (gpointer) OPT_WINTRANS_IM_ALPHA); gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); gtk_widget_show_all(hbox); gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); /* Buddy List trans options */ bltransbox = pidgin_make_frame (ret, _("Buddy List Window")); button = pidgin_prefs_checkbox(_("_Buddy List window transparency"), OPT_WINTRANS_BL_ENABLED, bltransbox); g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(set_blist_trans), (gpointer) OPT_WINTRANS_BL_ENABLED); trans_box = gtk_vbox_new(FALSE, 18); if (!purple_prefs_get_bool(OPT_WINTRANS_BL_ENABLED)) gtk_widget_set_sensitive(GTK_WIDGET(trans_box), FALSE); gtk_widget_show(trans_box); g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(pidgin_toggle_sensitive), trans_box); button = pidgin_prefs_checkbox( _("Remove Buddy List window transparency on focus"), OPT_WINTRANS_BL_ONFOCUS, trans_box); button = pidgin_prefs_checkbox(_("Always on top"), OPT_WINTRANS_BL_ONTOP, trans_box); g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(set_blist_trans), (gpointer) OPT_WINTRANS_BL_ONTOP); gtk_box_pack_start(GTK_BOX(bltransbox), trans_box, FALSE, FALSE, 5); /* IM transparency slider */ hbox = gtk_hbox_new(FALSE, 5); label = gtk_label_new(_("Opacity:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); slider = gtk_hscale_new_with_range(50, 255, 1); gtk_range_set_value(GTK_RANGE(slider), purple_prefs_get_int(OPT_WINTRANS_BL_ALPHA)); gtk_widget_set_usize(GTK_WIDGET(slider), 200, -1); g_signal_connect(GTK_OBJECT(slider), "value-changed", G_CALLBACK(bl_alpha_change), NULL); g_signal_connect(GTK_OBJECT(slider), "focus-out-event", G_CALLBACK(alpha_pref_set_int), (gpointer) OPT_WINTRANS_BL_ALPHA); gtk_box_pack_start(GTK_BOX(hbox), slider, FALSE, TRUE, 5); gtk_widget_show_all(hbox); gtk_box_pack_start(GTK_BOX(trans_box), hbox, FALSE, FALSE, 5); gtk_widget_show_all(ret); return ret; }
static GtkWidget * get_config_frame(PurplePlugin *plugin) { GString *base_dir_name= NULL, *lang_dir_name= NULL; GtkObject *stretch_duration_adjustment; GtkObject *maxlength_adjustment; GtkWidget *parent, *config_vbox, *voices_vbox, *stretch_duration_hbox, *maxlength_hbox, *frame, *radio_button, *message_label, *stretch_duration_spinbutton, *maxlength_spinbutton, *prepend_who_checkbutton, *replace_url_checkbutton, *announce_events_checkbutton; GSList *radio_group=NULL; DIR *dir, *lang_dir; struct dirent *next_lang, *next_voice; int count_lang, count_voices; int can_activate_voice= FALSE; parent = gtk_vbox_new(FALSE,5); gtk_container_set_border_width(GTK_CONTAINER(parent), 12); config_vbox = (GtkWidget *) pidgin_make_frame(parent, _("Festival")); gtk_container_set_border_width(GTK_CONTAINER(config_vbox), 5); /*--------------- Available Voices -----------*/ base_dir_name= g_string_new(FESTIVAL_VOICES_PATH); lang_dir_name= g_string_new(""); message_label= gtk_label_new(_("Availables voices:")); gtk_box_pack_start(GTK_BOX(config_vbox),message_label,FALSE,TRUE,3); //Examine directory for voices dir= opendir(base_dir_name->str); if(!dir) { GString *error_name; error_name= g_string_new(""); g_string_printf(error_name, _("Error opening voices directory: %s"), base_dir_name->str); message_label= gtk_label_new(error_name->str); g_string_free(error_name,TRUE); gtk_box_pack_start(GTK_BOX(config_vbox),message_label,FALSE,TRUE,3); } else { count_lang=0; while( ( next_lang = readdir(dir) ) !=0 ) { /* hide hidden files */ if( *next_lang->d_name == '.' ) continue; frame= gtk_frame_new(next_lang->d_name); gtk_box_pack_start(GTK_BOX(config_vbox),frame,FALSE,TRUE,3); voices_vbox= gtk_vbox_new(FALSE,5); gtk_container_set_border_width(GTK_CONTAINER(voices_vbox), 5); gtk_container_add(GTK_CONTAINER(frame),voices_vbox); g_string_printf(lang_dir_name,"%s/%s",base_dir_name->str,next_lang->d_name); lang_dir= opendir(lang_dir_name->str); if(!lang_dir) { GString *error_name; error_name= g_string_new(""); g_string_printf( error_name, _("Error opening voice directory: %s"), lang_dir_name->str); message_label= gtk_label_new(error_name->str); g_string_free(error_name,TRUE); gtk_box_pack_start( GTK_BOX(voices_vbox), message_label, FALSE, TRUE, 3); break; } count_voices=0; while( ( next_voice = readdir(lang_dir) )!=0 ) { GString *voice_name; /* hide hidden files */ if( *next_voice->d_name == '.' ) continue; radio_button= gtk_radio_button_new_with_label(radio_group,next_voice->d_name); if( purple_prefs_get_string("/plugins/gtk/festival/speaker/voice") && strcmp(purple_prefs_get_string("/plugins/gtk/festival/speaker/voice"),next_voice->d_name ) == 0) { gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(radio_button),TRUE ); can_activate_voice= TRUE; } voice_name= g_string_new(next_voice->d_name); g_signal_connect(GTK_OBJECT(radio_button),"clicked", G_CALLBACK(on_radio_clicked), voice_name); g_signal_connect(GTK_OBJECT(radio_button),"destroy", G_CALLBACK(on_radio_destroy), voice_name); gtk_box_pack_start(GTK_BOX(voices_vbox), radio_button, FALSE, TRUE, 3); radio_group= gtk_radio_button_get_group( GTK_RADIO_BUTTON(radio_button) ); } closedir(lang_dir); } closedir(dir); } g_string_free(base_dir_name,TRUE); g_string_free(lang_dir_name,TRUE); /*--------------- Replace URL -----------*/ replace_url_checkbutton = gtk_check_button_new_with_label( _("Replace \"http://www.someurl.com\" with URL")); if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/replace_url")) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(replace_url_checkbutton), TRUE); g_signal_connect(G_OBJECT(replace_url_checkbutton), "clicked", G_CALLBACK(on_replace_url_checkbutton_clicked), NULL); gtk_box_pack_end(GTK_BOX(config_vbox),replace_url_checkbutton,FALSE,TRUE,3); /*--------------- Prepend Alias -----------*/ prepend_who_checkbutton = gtk_check_button_new_with_label(_("Prepend Buddy Name (Alias) to message")); if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/prepend_who")) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(prepend_who_checkbutton), TRUE); g_signal_connect(G_OBJECT(prepend_who_checkbutton), "clicked", G_CALLBACK(on_prepend_who_checkbutton_clicked), NULL); gtk_box_pack_end(GTK_BOX(config_vbox),prepend_who_checkbutton,FALSE,TRUE,3); /*--------------- Announce Events -----------*/ announce_events_checkbutton = gtk_check_button_new_with_label(_("Announce events")); if(purple_prefs_get_bool("/plugins/gtk/festival/speaker/announce_events")) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(announce_events_checkbutton), TRUE); g_signal_connect(G_OBJECT(announce_events_checkbutton), "clicked", G_CALLBACK(on_announce_events_checkbutton_clicked), NULL); gtk_box_pack_end(GTK_BOX(config_vbox),announce_events_checkbutton,FALSE,TRUE,3); /*--------------- Duration -----------*/ stretch_duration_hbox= gtk_hbox_new(FALSE,3); stretch_duration_adjustment= gtk_adjustment_new(1.0,0.3,10.0,0.1,1.0,1.0); stretch_duration_spinbutton= gtk_spin_button_new(GTK_ADJUSTMENT(stretch_duration_adjustment),0.1,1); g_signal_connect(G_OBJECT(stretch_duration_spinbutton), "value_changed", G_CALLBACK(on_stretch_duration_spinbutton_changed), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(stretch_duration_spinbutton),GTK_UPDATE_IF_VALID); gtk_entry_set_editable(GTK_ENTRY(stretch_duration_spinbutton),FALSE); gtk_box_pack_start(GTK_BOX(stretch_duration_hbox),gtk_label_new(_("Pitch")),FALSE,FALSE,3); gtk_box_pack_start(GTK_BOX(stretch_duration_hbox),stretch_duration_spinbutton,FALSE,FALSE,3); gtk_box_pack_end(GTK_BOX(config_vbox),stretch_duration_hbox,FALSE,TRUE,3); gtk_spin_button_set_value( GTK_SPIN_BUTTON(stretch_duration_spinbutton), atof (purple_prefs_get_string("/plugins/gtk/festival/speaker/duration"))); /*--------------- Max Length -----------*/ maxlength_hbox= gtk_hbox_new(FALSE,3); maxlength_adjustment= gtk_adjustment_new(256,0,1000,1,256,256); maxlength_spinbutton= gtk_spin_button_new(GTK_ADJUSTMENT(maxlength_adjustment),1,0); g_signal_connect(G_OBJECT(maxlength_spinbutton), "value_changed", G_CALLBACK(on_maxlength_spinbutton_changed), NULL); gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(maxlength_spinbutton),GTK_UPDATE_IF_VALID); gtk_entry_set_editable(GTK_ENTRY(maxlength_spinbutton),FALSE); gtk_box_pack_start(GTK_BOX(maxlength_hbox),gtk_label_new(_("Max Length")),FALSE,FALSE,3); gtk_box_pack_start(GTK_BOX(maxlength_hbox),maxlength_spinbutton,FALSE,FALSE,3); gtk_box_pack_end(GTK_BOX(config_vbox),maxlength_hbox,FALSE,TRUE,3); gtk_spin_button_set_value( GTK_SPIN_BUTTON(maxlength_spinbutton), purple_prefs_get_int("/plugins/gtk/festival/speaker/maxlength")); if(!can_activate_voice && radio_group) { GtkRadioButton *default_radio; default_radio= GTK_RADIO_BUTTON( g_slist_nth(radio_group,0)->data ); gtk_button_clicked( GTK_BUTTON(default_radio) ); } gtk_widget_show_all(parent); return parent; }