4
#include "musictracker.h"
9
accept_dialog(GtkDialog* dialog)
11
gtk_dialog_response(dialog, GTK_RESPONSE_ACCEPT);
15
input_dialog(const char *title, char *buf, int len)
17
GtkWidget *dialog = gtk_dialog_new();
18
gtk_window_set_title(GTK_WINDOW(dialog), "MusicTracker");
19
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
21
gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT);
22
gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT);
24
GtkWidget *label = gtk_label_new(title);
25
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), label, TRUE, TRUE,
28
GtkWidget *entry = gtk_entry_new_with_max_length(len);
29
gtk_entry_set_text(GTK_ENTRY(entry), buf);
30
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), entry,
32
g_signal_connect_swapped(entry, "activate",
33
G_CALLBACK(accept_dialog), dialog);
35
gtk_widget_show_all(dialog);
37
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
38
strncpy(buf, gtk_entry_get_text(GTK_ENTRY(entry)), len);
39
gtk_widget_destroy(dialog);
42
gtk_widget_destroy (dialog);
46
//--------------------------------------------------------------------
49
action_off_status(PurplePluginAction *action)
52
strncpy(buf, purple_prefs_get_string("/plugins/core/musictracker/string_off"), STRLEN);
53
if (input_dialog("Status to Set When Player is OFF:", buf, STRLEN)) {
54
purple_prefs_set_string("/plugins/core/musictracker/string_off",
59
//--------------------------------------------------------------------
62
action_toggle_status(PurplePluginAction *action)
65
gboolean flag = !purple_prefs_get_bool("/plugins/core/musictracker/bool_disabled");
69
set_userstatus_for_active_accounts("", 0);
70
label = "Activate Status Changing";
74
label = "Deactivate Status Changing";
77
purple_prefs_set_bool("/plugins/core/musictracker/bool_disabled", flag);
79
// update label for action
80
g_free(action->label);
81
action->label = g_strdup(label);
83
// force pidgin to update the tools menu
84
pidgin_blist_update_plugin_actions();
87
//--------------------------------------------------------------------
90
actions_list(PurplePlugin *plugin, gpointer context)
93
PurplePluginAction *act;
95
gboolean flag = purple_prefs_get_bool("/plugins/core/musictracker/bool_disabled");
96
act = purple_plugin_action_new(flag ? "Activate Status Changing" : "Deactivate Status Changing", action_toggle_status);
97
list = g_list_append(list, act);
99
act = purple_plugin_action_new("Change Player-Off Status...", action_off_status);
100
list = g_list_append(list, act);