annotate plugins/musicmessaging/musicmessaging.c @ 11170:0e9e2b923d09

[gaim-migrate @ 13271] Fixed some bugs and made some additions to the XSUBS. Added some of my test scripts which are incomplete, but mostly functional. GaimPluginPrefs and GaimGtkPluginPrefs--using evals to do the Gtk widgets with gtk2-perl--work. Plugin actions can now be added, but only one for now. committer: Tailor Script <tailor@pidgin.im>
author John H. Kelm <johnkelm@gmail.com>
date Fri, 29 Jul 2005 13:38:00 +0000
parents 778d5464a9b8
children 4295083cf489
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
1 #include "internal.h"
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
2 #include "gtkgaim.h"
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
3
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
4 #include "conversation.h"
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
5
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
6 #include "gtkconv.h"
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
7 #include "gtkplugin.h"
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
8 #include "gtkutils.h"
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
9
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
10 #include "notify.h"
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
11 #include "version.h"
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
12
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
13 #define MUSICMESSAGIN_PLUGIN_ID "gtk-hazure-musicmessaging"
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
14
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
15 static gboolean start_session(void);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
16 static void run_editor(void);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
17 static void add_button (GaimConversation *conv);
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
18 static void remove_button (GtkWidget *button);
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
19
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
20 typedef struct {
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
21 GaimBuddy *buddy;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
22 GtkWidget *window;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
23 /* Something for the ly file? */
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
24
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
25 /* Anything else needed for a session? */
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
26
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
27 } MMSession;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
28
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
29 /* List of sessions */
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
30 GList *sessions;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
31
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
32 /* List of created buttons */
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
33 GList *widgets;
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
34
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
35 /* Pointer to this plugin */
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
36 GaimPlugin *plugin_pointer;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
37
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
38 static gboolean
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
39 plugin_load(GaimPlugin *plugin) {
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
40 gaim_notify_message(plugin, GAIM_NOTIFY_MSG_INFO, "Welcome",
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
41 "Welcome to music messaging.", NULL, NULL, NULL);
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
42 /* Keep the plugin for reference (needed for notify's) */
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
43 plugin_pointer = plugin;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
44
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
45 /* Add the button to all the current conversations */
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
46 gaim_conversation_foreach (add_button);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
47
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
48 /* Listen for any new conversations */
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
49 void *conv_list_handle = gaim_conversations_get_handle();
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
50
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
51 gaim_signal_connect(conv_list_handle, "conversation-created",
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
52 plugin, GAIM_CALLBACK(add_button), NULL);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
53
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
54 return TRUE;
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
55 }
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
56
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
57 static gboolean
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
58 plugin_unload(GaimPlugin *plugin) {
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
59
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
60 gaim_notify_message(plugin, GAIM_NOTIFY_MSG_INFO, "Unloaded",
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
61 gaim_prefs_get_string ("/plugins/gtk/musicmessaging/editor_path"), NULL, NULL, NULL);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
62
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
63 g_list_foreach(widgets, (GFunc) remove_button, NULL);
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
64 return TRUE;
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
65 }
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
66
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
67 static gboolean
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
68 start_session(void)
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
69 {
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
70 run_editor();
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
71 return TRUE;
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
72 }
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
73
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
74 static void music_button_toggled (GtkWidget *widget, gpointer data)
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
75 {
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
76 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
77 {
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
78 start_session();
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
79 } else {
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
80
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
81 /* kill program */
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
82 }
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
83 }
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
84
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
85 static void set_editor_path (GtkWidget *button, GtkWidget *text_field)
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
86 {
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
87 const char * path = gtk_entry_get_text((GtkEntry*)text_field);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
88 gaim_prefs_set_string("/plugins/gtk/musicmessaging/editor_path", path);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
89
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
90 }
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
91
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
92 static void run_editor (void)
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
93 {
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
94 GError *spawn_error = NULL;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
95 gchar * args[2];
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
96 args[0] = (gchar *)gaim_prefs_get_string("/plugins/gtk/musicmessaging/editor_path");
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
97 args[1] = NULL;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
98 if (!(g_spawn_async (".", args, NULL, 0, NULL, NULL, NULL, &spawn_error)))
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
99 {
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
100 gaim_notify_error(plugin_pointer, "Error Running Editor",
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
101 "The following error has occured:", spawn_error->message);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
102 }
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
103 }
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
104
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
105 static void add_button (GaimConversation *conv)
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
106 {
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
107 GtkWidget *button, *image, *sep;
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
108
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
109 button = gtk_toggle_button_new();
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
110 gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
111
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
112 g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(music_button_toggled), NULL);
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
113
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
114 gchar *file_path = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", "music.png", NULL);
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
115 image = gtk_image_new_from_file("/usr/local/share/pixmaps/gaim/buttons/music.png");
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
116
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
117 gtk_container_add((GtkContainer *)button, image);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
118
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
119 sep = gtk_vseparator_new();
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
120
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
121 g_list_append(widgets, sep);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
122 g_list_append(widgets, button);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
123
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
124 gtk_widget_show(sep);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
125 gtk_widget_show(image);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
126 gtk_widget_show(button);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
127
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
128 gtk_box_pack_start(GTK_BOX(GAIM_GTK_CONVERSATION(conv)->toolbar), sep, FALSE, FALSE, 0);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
129 gtk_box_pack_start(GTK_BOX(GAIM_GTK_CONVERSATION(conv)->toolbar), button, FALSE, FALSE, 0);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
130 }
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
131
11169
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
132 static void remove_button (GtkWidget *button)
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
133 {
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
134 gtk_widget_hide(button);
778d5464a9b8 [gaim-migrate @ 13270]
Christian Muise <christian.muise@gmail.com>
parents: 11166
diff changeset
135 gtk_widget_destroy(button);
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
136 }
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
137
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
138 static GtkWidget *
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
139 get_config_frame(GaimPlugin *plugin)
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
140 {
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
141 GtkWidget *ret;
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
142 GtkWidget *vbox;
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
143
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
144 GtkWidget *editor_path;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
145 GtkWidget *editor_path_label;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
146 GtkWidget *editor_path_button;
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
147
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
148 /* Outside container */
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
149 ret = gtk_vbox_new(FALSE, 18);
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
150 gtk_container_set_border_width(GTK_CONTAINER(ret), 10);
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
151
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
152 /* Configuration frame */
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
153 vbox = gaim_gtk_make_frame(ret, _("Music Messaging Configuration"));
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
154
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
155 /* Path to the score editor */
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
156 editor_path = gtk_entry_new();
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
157 editor_path_label = gtk_label_new("Score Editor Path");
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
158 editor_path_button = gtk_button_new_with_mnemonic(_("_Apply"));
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
159
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
160 gtk_entry_set_text((GtkEntry*)editor_path, "/usr/local/bin/gscore");
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
161
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
162 g_signal_connect(G_OBJECT(editor_path_button), "clicked",
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
163 G_CALLBACK(set_editor_path), editor_path);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
164
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
165 gtk_box_pack_start(GTK_BOX(vbox), editor_path_label, FALSE, FALSE, 0);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
166 gtk_box_pack_start(GTK_BOX(vbox), editor_path, FALSE, FALSE, 0);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
167 gtk_box_pack_start(GTK_BOX(vbox), editor_path_button, FALSE, FALSE, 0);
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
168
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
169 gtk_widget_show_all(ret);
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
170
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
171 return ret;
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
172 }
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
173
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
174 static GaimGtkPluginUiInfo ui_info =
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
175 {
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
176 get_config_frame
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
177 };
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
178
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
179 static GaimPluginInfo info = {
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
180 GAIM_PLUGIN_MAGIC,
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
181 GAIM_MAJOR_VERSION,
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
182 GAIM_MINOR_VERSION,
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
183 GAIM_PLUGIN_STANDARD,
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
184 GAIM_GTK_PLUGIN_TYPE,
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
185 0,
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
186 NULL,
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
187 GAIM_PRIORITY_DEFAULT,
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
188
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
189 MUSICMESSAGIN_PLUGIN_ID,
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
190 "Music Messaging",
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
191 VERSION,
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
192 "Music Messaging Plugin for collabrative composition.",
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
193 "The Music Messaging Plugin allows a number of users to simultaniously work on a piece of music by editting a common score in real-time.",
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
194 "Christian Muise <christian.muise@gmail.com>",
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
195 GAIM_WEBSITE,
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
196 plugin_load,
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
197 plugin_unload,
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
198 NULL,
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
199 &ui_info,
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
200 NULL,
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
201 NULL,
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
202 NULL
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
203 };
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
204
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
205 static void
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
206 init_plugin(GaimPlugin *plugin) {
11166
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
207 gaim_prefs_add_none("/plugins/gtk/musicmessaging");
268d5c498b64 [gaim-migrate @ 13267]
Christian Muise <christian.muise@gmail.com>
parents: 11108
diff changeset
208 gaim_prefs_add_string("/plugins/gtk/musicmessaging/editor_path", "/usr/local/bin/gscore");
11088
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
209 }
b8bfa71e5595 [gaim-migrate @ 13108]
Christian Muise <christian.muise@gmail.com>
parents:
diff changeset
210
11108
641915a13cec [gaim-migrate @ 13157]
Christian Muise <christian.muise@gmail.com>
parents: 11088
diff changeset
211 GAIM_INIT_PLUGIN(musicmessaging, init_plugin, info);