void finch_sounds_show_all(void) { GntWidget *box, *tmpbox, *splitbox, *cmbox, *slider; GntWidget *entry; GntWidget *chkbox; GntWidget *button; GntWidget *label; GntWidget *tree; GntWidget *win; gint i; GList *itr, *list; if (pref_dialog) { gnt_window_present(pref_dialog->window); return; } pref_dialog = g_new0(SoundPrefDialog, 1); pref_dialog->original_profile = g_strdup(finch_sound_get_active_profile()); pref_dialog->window = win = gnt_window_box_new(FALSE, TRUE); gnt_box_set_pad(GNT_BOX(win), 0); gnt_box_set_toplevel(GNT_BOX(win), TRUE); gnt_box_set_title(GNT_BOX(win), _("Sound Preferences")); gnt_box_set_fill(GNT_BOX(win), TRUE); gnt_box_set_alignment(GNT_BOX(win), GNT_ALIGN_MID); /* Profiles */ splitbox = gnt_hbox_new(FALSE); gnt_box_set_pad(GNT_BOX(splitbox), 0); gnt_box_set_alignment(GNT_BOX(splitbox), GNT_ALIGN_TOP); box = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(box), 0); gnt_box_add_widget(GNT_BOX(box), gnt_label_new_with_format(_("Profiles"), GNT_TEXT_FLAG_BOLD)); pref_dialog->profiles = tree = gnt_tree_new(); gnt_tree_set_hash_fns(GNT_TREE(tree), g_str_hash, g_str_equal, g_free); gnt_tree_set_compare_func(GNT_TREE(tree), (GCompareFunc)g_ascii_strcasecmp); g_signal_connect(G_OBJECT(tree), "selection-changed", G_CALLBACK(prof_load_cb), NULL); itr = list = finch_sound_get_profiles(); for (; itr; itr = itr->next) { /* Do not free itr->data. It's the stored as a key for the tree, and will * be freed when the tree is destroyed. */ gnt_tree_add_row_after(GNT_TREE(tree), itr->data, gnt_tree_create_row(GNT_TREE(tree), itr->data), NULL, NULL); } g_list_free(list); gnt_box_add_widget(GNT_BOX(box), tree); pref_dialog->new_profile = entry = gnt_entry_new(""); gnt_box_add_widget(GNT_BOX(box), entry); tmpbox = gnt_hbox_new(FALSE); button = gnt_button_new("Add"); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(prof_add_cb), entry); gnt_box_add_widget(GNT_BOX(tmpbox), button); button = gnt_button_new("Delete"); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(prof_del_cb), NULL); gnt_box_add_widget(GNT_BOX(tmpbox), button); gnt_box_add_widget(GNT_BOX(box), tmpbox); gnt_box_add_widget(GNT_BOX(splitbox), box); gnt_box_add_widget(GNT_BOX(splitbox), gnt_vline_new()); /* Sound method */ box = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(box), 0); pref_dialog->method = cmbox = gnt_combo_box_new(); gnt_tree_set_hash_fns(GNT_TREE(GNT_COMBO_BOX(cmbox)->dropdown), g_str_hash, g_str_equal, NULL); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "automatic", _("Automatic")); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "alsa", "ALSA"); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "esd", "ESD"); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "beep", _("Console Beep")); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "custom", _("Command")); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), "nosound", _("No Sound")); label = gnt_label_new_with_format(_("Sound Method"), GNT_TEXT_FLAG_BOLD); gnt_box_add_widget(GNT_BOX(box), label); tmpbox = gnt_hbox_new(TRUE); gnt_box_set_fill(GNT_BOX(tmpbox), FALSE); gnt_box_set_pad(GNT_BOX(tmpbox), 0); gnt_box_add_widget(GNT_BOX(tmpbox), gnt_label_new(_("Method: "))); gnt_box_add_widget(GNT_BOX(tmpbox), cmbox); gnt_box_add_widget(GNT_BOX(box), tmpbox); tmpbox = gnt_hbox_new(TRUE); gnt_box_set_pad(GNT_BOX(tmpbox), 0); gnt_box_set_fill(GNT_BOX(tmpbox), FALSE); gnt_box_add_widget(GNT_BOX(tmpbox), gnt_label_new(_("Sound Command\n(%s for filename)"))); pref_dialog->command = entry = gnt_entry_new(""); gnt_box_add_widget(GNT_BOX(tmpbox), entry); gnt_box_add_widget(GNT_BOX(box), tmpbox); gnt_box_add_widget(GNT_BOX(box), gnt_line_new(FALSE)); /* Sound options */ gnt_box_add_widget(GNT_BOX(box), gnt_label_new_with_format(_("Sound Options"), GNT_TEXT_FLAG_BOLD)); pref_dialog->conv_focus = chkbox = gnt_check_box_new(_("Sounds when conversation has focus")); gnt_box_add_widget(GNT_BOX(box), chkbox); tmpbox = gnt_hbox_new(TRUE); gnt_box_set_pad(GNT_BOX(tmpbox), 0); gnt_box_set_fill(GNT_BOX(tmpbox), FALSE); gnt_box_add_widget(GNT_BOX(tmpbox), gnt_label_new("Enable Sounds:")); pref_dialog->while_status = cmbox = gnt_combo_box_new(); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), GINT_TO_POINTER(3), _("Always")); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), GINT_TO_POINTER(1), _("Only when available")); gnt_combo_box_add_data(GNT_COMBO_BOX(cmbox), GINT_TO_POINTER(2), _("Only when not available")); gnt_box_add_widget(GNT_BOX(tmpbox), cmbox); gnt_box_add_widget(GNT_BOX(box), tmpbox); tmpbox = gnt_hbox_new(TRUE); gnt_box_set_pad(GNT_BOX(tmpbox), 0); gnt_box_set_fill(GNT_BOX(tmpbox), FALSE); gnt_box_add_widget(GNT_BOX(tmpbox), gnt_label_new(_("Volume(0-100):"))); pref_dialog->volume = slider = gnt_slider_new(FALSE, 100, 0); gnt_slider_set_step(GNT_SLIDER(slider), 5); gnt_slider_set_small_step(GNT_SLIDER(slider), 1); gnt_slider_set_large_step(GNT_SLIDER(slider), 20); label = gnt_label_new(""); gnt_slider_reflect_label(GNT_SLIDER(slider), GNT_LABEL(label)); gnt_box_set_pad(GNT_BOX(tmpbox), 1); gnt_box_add_widget(GNT_BOX(tmpbox), slider); gnt_box_add_widget(GNT_BOX(tmpbox), label); gnt_box_add_widget(GNT_BOX(box), tmpbox); gnt_box_add_widget(GNT_BOX(splitbox), box); gnt_box_add_widget(GNT_BOX(win), splitbox); gnt_box_add_widget(GNT_BOX(win), gnt_hline_new()); /* Sound events */ gnt_box_add_widget(GNT_BOX(win), gnt_label_new_with_format(_("Sound Events"), GNT_TEXT_FLAG_BOLD)); pref_dialog->events = tree = gnt_tree_new_with_columns(2); gnt_tree_set_column_titles(GNT_TREE(tree), _("Event"), _("File")); gnt_tree_set_show_title(GNT_TREE(tree), TRUE); for (i = 0; i < PURPLE_NUM_SOUNDS; i++) { FinchSoundEvent * event = &sounds[i]; if (event->label == NULL) { continue; } gnt_tree_add_choice(GNT_TREE(tree), GINT_TO_POINTER(i), gnt_tree_create_row(GNT_TREE(tree), event->label, event->def), NULL, NULL); } gnt_tree_adjust_columns(GNT_TREE(tree)); gnt_box_add_widget(GNT_BOX(win), tree); box = gnt_hbox_new(FALSE); button = gnt_button_new(_("Test")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(test_cb), NULL); gnt_box_add_widget(GNT_BOX(box), button); button = gnt_button_new(_("Reset")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(reset_cb), NULL); gnt_box_add_widget(GNT_BOX(box), button); button = gnt_button_new(_("Choose...")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(choose_cb), NULL); gnt_box_add_widget(GNT_BOX(box), button); gnt_box_add_widget(GNT_BOX(win), box); gnt_box_add_widget(GNT_BOX(win), gnt_line_new(FALSE)); /* Add new stuff before this */ box = gnt_hbox_new(FALSE); gnt_box_set_fill(GNT_BOX(box), TRUE); button = gnt_button_new(_("Save")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_cb), win); gnt_box_add_widget(GNT_BOX(box), button); button = gnt_button_new(_("Cancel")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cancel_cb), win); gnt_box_add_widget(GNT_BOX(box), button); gnt_box_add_widget(GNT_BOX(win), box); g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(release_pref_dialog), NULL); load_pref_window(finch_sound_get_active_profile()); gnt_widget_show(win); }
void finch_xfer_dialog_new(void) { GList *iter; GntWidget *window; GntWidget *bbox; GntWidget *button; GntWidget *checkbox; GntWidget *tree; int widths[] = {8, 12, 8, 8, 8, 8, -1}; if (!xfer_dialog) xfer_dialog = g_new0(PurpleGntXferDialog, 1); xfer_dialog->keep_open = purple_prefs_get_bool("/finch/filetransfer/keep_open"); xfer_dialog->auto_clear = purple_prefs_get_bool("/finch/filetransfer/clear_finished"); /* Create the window. */ xfer_dialog->window = window = gnt_vbox_new(FALSE); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(finch_xfer_dialog_destroy), NULL); gnt_box_set_toplevel(GNT_BOX(window), TRUE); gnt_box_set_title(GNT_BOX(window), _("File Transfers")); gnt_box_set_fill(GNT_BOX(window), TRUE); gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); xfer_dialog->tree = tree = gnt_tree_new_with_columns(NUM_COLUMNS); gnt_tree_set_column_titles(GNT_TREE(tree), _("Progress"), _("Filename"), _("Size"), _("Speed"), _("Remaining"), _("Status")); gnt_tree_set_column_width_ratio(GNT_TREE(tree), widths); gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_PROGRESS, FALSE); gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_SIZE, FALSE); gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_SPEED, FALSE); gnt_tree_set_column_resizable(GNT_TREE(tree), COLUMN_REMAINING, FALSE); gnt_widget_set_size(tree, 70, -1); gnt_tree_set_show_title(GNT_TREE(tree), TRUE); gnt_box_add_widget(GNT_BOX(window), tree); checkbox = gnt_check_box_new( _("Close this window when all transfers finish")); gnt_check_box_set_checked(GNT_CHECK_BOX(checkbox), !xfer_dialog->keep_open); g_signal_connect(G_OBJECT(checkbox), "toggled", G_CALLBACK(toggle_keep_open_cb), NULL); gnt_box_add_widget(GNT_BOX(window), checkbox); checkbox = gnt_check_box_new(_("Clear finished transfers")); gnt_check_box_set_checked(GNT_CHECK_BOX(checkbox), xfer_dialog->auto_clear); g_signal_connect(G_OBJECT(checkbox), "toggled", G_CALLBACK(toggle_clear_finished_cb), NULL); gnt_box_add_widget(GNT_BOX(window), checkbox); bbox = gnt_hbox_new(FALSE); xfer_dialog->remove_button = button = gnt_button_new(_("Remove")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(remove_button_cb), NULL); gnt_box_add_widget(GNT_BOX(bbox), button); xfer_dialog->stop_button = button = gnt_button_new(_("Stop")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(stop_button_cb), NULL); gnt_box_add_widget(GNT_BOX(bbox), button); xfer_dialog->close_button = button = gnt_button_new(_("Close")); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(finch_xfer_dialog_destroy), NULL); gnt_box_add_widget(GNT_BOX(bbox), button); gnt_box_add_widget(GNT_BOX(window), bbox); for (iter = purple_xfers_get_all(); iter; iter = iter->next) { PurpleXfer *xfer = (PurpleXfer *)iter->data; PurpleGntXferUiData *data = FINCHXFER(xfer); if (data->in_list) { finch_xfer_dialog_add_xfer(xfer); finch_xfer_dialog_update_xfer(xfer); gnt_tree_set_selected(GNT_TREE(tree), xfer); } } gnt_widget_show(xfer_dialog->window); }
void finch_pounce_editor_show(PurpleAccount *account, const char *name, PurplePounce *cur_pounce) { PurpleGntPounceDialog *dialog; GntWidget *window; GntWidget *bbox; GntWidget *hbox, *vbox; GntWidget *button; GntWidget *combo; GList *list; g_return_if_fail((cur_pounce != NULL) || (account != NULL) || (purple_accounts_get_all() != NULL)); dialog = g_new0(PurpleGntPounceDialog, 1); if (cur_pounce != NULL) { dialog->pounce = cur_pounce; dialog->account = purple_pounce_get_pouncer(cur_pounce); } else if (account != NULL) { dialog->pounce = NULL; dialog->account = account; } else { GList *connections = purple_connections_get_all(); PurpleConnection *gc; if (connections != NULL) { gc = (PurpleConnection *)connections->data; dialog->account = purple_connection_get_account(gc); } else dialog->account = purple_accounts_get_all()->data; dialog->pounce = NULL; } /* Create the window. */ dialog->window = window = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(window), 0); gnt_box_set_toplevel(GNT_BOX(window), TRUE); gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_LEFT); gnt_box_set_title(GNT_BOX(window), (cur_pounce == NULL ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(delete_win_cb), dialog); gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Pounce on Whom"), GNT_TEXT_FLAG_BOLD)); /* Account: */ gnt_box_add_widget(GNT_BOX(window), gnt_label_new(_("Account:"))); dialog->account_menu = combo = gnt_combo_box_new(); list = purple_accounts_get_all(); for (; list; list = list->next) { PurpleAccount *account; char *text; account = list->data; text = g_strdup_printf("%s (%s)", purple_account_get_username(account), purple_account_get_protocol_name(account)); gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text); g_free(text); } if (dialog->account) gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), dialog->account); gnt_box_add_widget(GNT_BOX(window), combo); /* Buddy: */ hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Buddy name:"))); dialog->buddy_entry = gnt_entry_new(NULL); gnt_box_add_widget(GNT_BOX(hbox), dialog->buddy_entry); setup_buddy_list_suggestion(GNT_ENTRY(dialog->buddy_entry), TRUE); gnt_box_add_widget(GNT_BOX(window), hbox); if (cur_pounce != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->buddy_entry), purple_pounce_get_pouncee(cur_pounce)); } else if (name != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->buddy_entry), name); } /* Create the event frame */ gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Pounce When Buddy..."), GNT_TEXT_FLAG_BOLD)); dialog->signon = gnt_check_box_new(_("Signs on")); dialog->signoff = gnt_check_box_new(_("Signs off")); dialog->away = gnt_check_box_new(_("Goes away")); dialog->away_return = gnt_check_box_new(_("Returns from away")); dialog->idle = gnt_check_box_new(_("Becomes idle")); dialog->idle_return = gnt_check_box_new(_("Is no longer idle")); dialog->typing = gnt_check_box_new(_("Starts typing")); dialog->typed = gnt_check_box_new(_("Pauses while typing")); dialog->stop_typing = gnt_check_box_new(_("Stops typing")); dialog->message_recv = gnt_check_box_new(_("Sends a message")); hbox = gnt_hbox_new(TRUE); gnt_box_set_pad(GNT_BOX(hbox), 2); vbox = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(vbox), 0); gnt_box_add_widget(GNT_BOX(hbox), vbox); gnt_box_add_widget(GNT_BOX(vbox), dialog->signon); gnt_box_add_widget(GNT_BOX(vbox), dialog->away); gnt_box_add_widget(GNT_BOX(vbox), dialog->idle); gnt_box_add_widget(GNT_BOX(vbox), dialog->typing); gnt_box_add_widget(GNT_BOX(vbox), dialog->stop_typing); vbox = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(vbox), 0); gnt_box_add_widget(GNT_BOX(hbox), vbox); gnt_box_add_widget(GNT_BOX(vbox), dialog->signoff); gnt_box_add_widget(GNT_BOX(vbox), dialog->away_return); gnt_box_add_widget(GNT_BOX(vbox), dialog->idle_return); gnt_box_add_widget(GNT_BOX(vbox), dialog->typed); gnt_box_add_widget(GNT_BOX(vbox), dialog->message_recv); gnt_box_add_widget(GNT_BOX(window), hbox); /* Create the "Action" frame. */ gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Action"), GNT_TEXT_FLAG_BOLD)); dialog->open_win = gnt_check_box_new(_("Open an IM window")); dialog->popup = gnt_check_box_new(_("Pop up a notification")); dialog->send_msg = gnt_check_box_new(_("Send a message")); dialog->exec_cmd = gnt_check_box_new(_("Execute a command")); dialog->play_sound = gnt_check_box_new(_("Play a sound")); dialog->send_msg_entry = gnt_entry_new(NULL); dialog->exec_cmd_entry = gnt_entry_new(NULL); dialog->popup_entry = gnt_entry_new(NULL); dialog->exec_cmd_entry = gnt_entry_new(NULL); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->open_win); gnt_box_add_widget(GNT_BOX(window), hbox); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->popup); gnt_box_add_widget(GNT_BOX(hbox), dialog->popup_entry); gnt_box_add_widget(GNT_BOX(window), hbox); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->send_msg); gnt_box_add_widget(GNT_BOX(hbox), dialog->send_msg_entry); gnt_box_add_widget(GNT_BOX(window), hbox); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->exec_cmd); gnt_box_add_widget(GNT_BOX(hbox), dialog->exec_cmd_entry); gnt_box_add_widget(GNT_BOX(window), hbox); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->play_sound); gnt_box_add_widget(GNT_BOX(window), hbox); gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Options"), GNT_TEXT_FLAG_BOLD)); dialog->on_away = gnt_check_box_new(_("Pounce only when my status is not Available")); gnt_box_add_widget(GNT_BOX(window), dialog->on_away); dialog->save_pounce = gnt_check_box_new(_("Recurring")); gnt_box_add_widget(GNT_BOX(window), dialog->save_pounce); gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); /* Now the button box! */ bbox = gnt_hbox_new(FALSE); /* Cancel button */ button = gnt_button_new(_("Cancel")); gnt_box_add_widget(GNT_BOX(bbox), button); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cancel_cb), dialog); /* Save button */ dialog->save_button = button = gnt_button_new(_("Save")); gnt_box_add_widget(GNT_BOX(bbox), button); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_pounce_cb), dialog); gnt_box_add_widget(GNT_BOX(window), bbox); /* Set the values of stuff. */ if (cur_pounce != NULL) { PurplePounceEvent events = purple_pounce_get_events(cur_pounce); PurplePounceOption options = purple_pounce_get_options(cur_pounce); const char *value; /* Options */ gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->on_away), (options & PURPLE_POUNCE_OPTION_AWAY)); /* Events */ gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->signon), (events & PURPLE_POUNCE_SIGNON)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->signoff), (events & PURPLE_POUNCE_SIGNOFF)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->away), (events & PURPLE_POUNCE_AWAY)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->away_return), (events & PURPLE_POUNCE_AWAY_RETURN)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->idle), (events & PURPLE_POUNCE_IDLE)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->idle_return), (events & PURPLE_POUNCE_IDLE_RETURN)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->typing), (events & PURPLE_POUNCE_TYPING)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->typed), (events & PURPLE_POUNCE_TYPED)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->stop_typing), (events & PURPLE_POUNCE_TYPING_STOPPED)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->message_recv), (events & PURPLE_POUNCE_MESSAGE_RECEIVED)); /* Actions */ gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->open_win), purple_pounce_action_is_enabled(cur_pounce, "open-window")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->popup), purple_pounce_action_is_enabled(cur_pounce, "popup-notify")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->send_msg), purple_pounce_action_is_enabled(cur_pounce, "send-message")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->exec_cmd), purple_pounce_action_is_enabled(cur_pounce, "execute-command")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->play_sound), purple_pounce_action_is_enabled(cur_pounce, "play-beep")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->save_pounce), purple_pounce_get_save(cur_pounce)); if ((value = purple_pounce_action_get_attribute(cur_pounce, "send-message", "message")) != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->send_msg_entry), value); } if ((value = purple_pounce_action_get_attribute(cur_pounce, "popup-notify", "reason")) != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->popup_entry), value); } if ((value = purple_pounce_action_get_attribute(cur_pounce, "execute-command", "command")) != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->exec_cmd_entry), value); } } else { PurpleBuddy *buddy = NULL; if (name != NULL) buddy = purple_find_buddy(account, name); /* Set some defaults */ if (buddy == NULL) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->signon), TRUE); } else { if (!PURPLE_BUDDY_IS_ONLINE(buddy)) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->signon), TRUE); } else { gboolean default_set = FALSE; PurplePresence *presence = purple_buddy_get_presence(buddy); if (purple_presence_is_idle(presence)) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->idle_return), TRUE); default_set = TRUE; } if (!purple_presence_is_available(presence)) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->away_return), TRUE); default_set = TRUE; } if (!default_set) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->signon), TRUE); } } } gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->open_win), purple_prefs_get_bool("/finch/pounces/default_actions/open-window")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->popup), purple_prefs_get_bool("/finch/pounces/default_actions/popup-notify")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->send_msg), purple_prefs_get_bool("/finch/pounces/default_actions/send-message")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->exec_cmd), purple_prefs_get_bool("/finch/pounces/default_actions/execute-command")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->play_sound), purple_prefs_get_bool("/finch/pounces/default_actions/play-beep")); } gnt_widget_show(window); }
void finch_debug_window_show() { GntWidget *wid, *box, *label; debug.paused = FALSE; if (debug.window) { gnt_window_present(debug.window); return; } debug.window = gnt_vbox_new(FALSE); gnt_box_set_toplevel(GNT_BOX(debug.window), TRUE); gnt_box_set_title(GNT_BOX(debug.window), _("Debug Window")); gnt_box_set_pad(GNT_BOX(debug.window), 0); gnt_box_set_alignment(GNT_BOX(debug.window), GNT_ALIGN_MID); debug.tview = gnt_text_view_new(); gnt_box_add_widget(GNT_BOX(debug.window), debug.tview); gnt_widget_set_size(debug.tview, purple_prefs_get_int(PREF_ROOT "/size/width"), purple_prefs_get_int(PREF_ROOT "/size/height")); g_signal_connect(G_OBJECT(debug.tview), "size_changed", G_CALLBACK(size_changed_cb), NULL); gnt_box_add_widget(GNT_BOX(debug.window), gnt_line_new(FALSE)); box = gnt_hbox_new(FALSE); gnt_box_set_alignment(GNT_BOX(box), GNT_ALIGN_MID); gnt_box_set_fill(GNT_BOX(box), FALSE); /* XXX: Setting the GROW_Y for the following widgets don't make sense. But right now * it's necessary to make the width of the debug window resizable ... like I said, * it doesn't make sense. The bug is likely in the packing in gntbox.c. */ wid = gnt_button_new(_("Clear")); g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(clear_debug_win), debug.tview); GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); gnt_box_add_widget(GNT_BOX(box), wid); wid = gnt_button_new(_("Save")); g_signal_connect(G_OBJECT(wid), "activate", G_CALLBACK(save_debug_win), debug.tview); GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); gnt_box_add_widget(GNT_BOX(box), wid); debug.search = gnt_entry_new(purple_prefs_get_string(PREF_ROOT "/filter")); label = gnt_label_new(_("Filter:")); GNT_WIDGET_UNSET_FLAGS(label, GNT_WIDGET_GROW_X); gnt_box_add_widget(GNT_BOX(box), label); gnt_box_add_widget(GNT_BOX(box), debug.search); g_signal_connect(G_OBJECT(debug.search), "text_changed", G_CALLBACK(update_filter_string), NULL); wid = gnt_check_box_new(_("Pause")); g_signal_connect(G_OBJECT(wid), "toggled", G_CALLBACK(toggle_pause), NULL); GNT_WIDGET_SET_FLAGS(wid, GNT_WIDGET_GROW_Y); gnt_box_add_widget(GNT_BOX(box), wid); gnt_box_add_widget(GNT_BOX(debug.window), box); GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_GROW_Y); gnt_widget_set_name(debug.window, "debug-window"); g_signal_connect(G_OBJECT(debug.window), "destroy", G_CALLBACK(reset_debug_win), NULL); gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(debug.tview), debug.window); gnt_text_view_attach_pager_widget(GNT_TEXT_VIEW(debug.tview), debug.window); gnt_widget_show(debug.window); }