Re: Tag support, dcop query support



On Sun, Aug 07, 2005 at 06:02:23PM +0800, Davyd Madeley wrote:
> On Sun, 2005-08-07 at 08:48 +0800, Grahame Bowland wrote:
> 
> > The attached patch adds support to Drivel for making tagged posts,
> > following the protocol changes noted here;
> > http://www.livejournal.com/community/lj_clients/184137.html
> 
> Not seeing an attachment.
> 
> I'm not sure that calling the dcop binary is even vaguely the sanest way
> to acheive this. I still think using D-BUS is a better idea. If you
> can't get D-BUS support into Amarok, a D-BUS proxy would be better, that
> is started by D-BUS' activation system and makes DCOP calls for you.
> 
> Actually, that's not such a stupid idea, are we sure that KDE don't have
> one?

Ah, whoops, forgot to attach it. Done.

I think it's pretty much whether you want something that works on anyone
with KDE's system, without relying on something that does not exist.
There is no bridge between D-Bus and DCOP, they are only talking about
an API-level shim to make it easier to convert programs over to using
DBUS.

Running the dcop binary;
  a) works
  b) is less than twenty lines of code
  c) doesn't add any extra external library dependencies. This is a Good
  thing. Note that dbus is not API stable and everyone has different,
  binary incompatible versions of it installed on their computer.

Give me a rational argument why running the dcop binary is bad :-P

Cheers
Grahame

? changes.patch
? depcomp
? drivel.patch
? install-sh
? missing
Index: configure.ac
===================================================================
RCS file: /cvs/gnome/drivel/configure.ac,v
retrieving revision 1.57
diff -p -u -r1.57 configure.ac
--- configure.ac	9 Jul 2005 03:11:42 -0000	1.57
+++ configure.ac	7 Aug 2005 00:39:22 -0000
@@ -158,6 +158,19 @@ if test x$SCROLLKEEPER_CONFIG = xno; the
 fi
 
 dnl
+dnl Check for dcop
+dnl
+
+AC_PATH_PROG(DCOP_PROGRAM, dcop, no)
+if test x$DCOP_PROGRAM = xno; then
+  AC_MSG_WARN(Couldn't find dcop, query of dcop music players disabled)
+  HAVE_DCOP=no
+else
+  AC_DEFINE_UNQUOTED(DCOP_PROGRAM, "$DCOP_PROGRAM", "definition of DCOP_PROGRAM")
+  HAVE_DCOP=yes
+fi
+
+dnl
 dnl Check for libcurl.
 dnl
 
@@ -214,6 +227,7 @@ drivel-$VERSION:
 	Compiler:			${CC}
 	Using gtkspell:			$HAVE_GTKSPELL
 	Rhythmbox interface:		$HAVE_RHYTHMBOX
+	DCOP interface:			$HAVE_DCOP
 	Update MIME database:		$HAVE_NEW_MIME
 	Update desktop database:	$HAVE_NEW_DESKTOP
 "
Index: src/blog_advogato.c
===================================================================
RCS file: /cvs/gnome/drivel/src/blog_advogato.c,v
retrieving revision 1.11
diff -p -u -r1.11 blog_advogato.c
--- src/blog_advogato.c	17 May 2005 01:27:11 -0000	1.11
+++ src/blog_advogato.c	7 Aug 2005 00:39:22 -0000
@@ -308,7 +308,7 @@ blog_advogato_parse_getevents_request (D
 		entry = convert_linebreaks_from_html (response);
 		
 		journal_edit_entry (dc, itemid, entry, NULL, NULL, NULL, NULL, NULL, 
-				NULL, NULL, NULL, NULL, NULL);
+				NULL, NULL, NULL, NULL, NULL, NULL);
 		
 		g_free (entry);
 	}
Index: src/blog_atom.c
===================================================================
RCS file: /cvs/gnome/drivel/src/blog_atom.c,v
retrieving revision 1.13
diff -p -u -r1.13 blog_atom.c
--- src/blog_atom.c	11 May 2005 02:23:41 -0000	1.13
+++ src/blog_atom.c	7 Aug 2005 00:39:22 -0000
@@ -455,7 +455,7 @@ blog_atom_parse_getevents_request (Drive
 			AtomEntry *entry = entries->data;
 			journal_edit_entry (dc, entry->id, entry->content, NULL, 
 					NULL, entry->title,	NULL, NULL, NULL, 
-					NULL, NULL, NULL, entry->link);
+					NULL, NULL, NULL, entry->link, NULL);
 		}
 		else
 		{
Index: src/blog_blogger.c
===================================================================
RCS file: /cvs/gnome/drivel/src/blog_blogger.c,v
retrieving revision 1.18
diff -p -u -r1.18 blog_blogger.c
--- src/blog_blogger.c	19 May 2005 21:59:00 -0000	1.18
+++ src/blog_blogger.c	7 Aug 2005 00:39:23 -0000
@@ -321,7 +321,7 @@ blog_blogger_parse_getevents_request (Dr
 		if (postid && content)
 		{
 			journal_edit_entry (dc, postid, content, NULL, NULL, NULL, NULL,
-					NULL, NULL, NULL, NULL, NULL, NULL);
+					NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 		}
 	}
 	else
Index: src/blog_lj.c
===================================================================
RCS file: /cvs/gnome/drivel/src/blog_lj.c,v
retrieving revision 1.27
diff -p -u -r1.27 blog_lj.c
--- src/blog_lj.c	25 Jun 2005 16:19:28 -0000	1.27
+++ src/blog_lj.c	7 Aug 2005 00:39:23 -0000
@@ -486,7 +486,7 @@ blog_lj_build_postevent_request (const g
 		gint moodid, const gchar *subject, const gchar *security, gint mask,
 		const gchar *picture, gint year, gint month, gint day, gint hour,
 		gint minute, gint nocomments, gint preformatted, 
-		const DrivelJournal *dj, gint backdate)
+		const DrivelJournal *dj, gint backdate, const gchar *taglist)
 {
 	DrivelRequest *dr;
 	const gchar *journal;
@@ -553,6 +553,13 @@ blog_lj_build_postevent_request (const g
 	g_snprintf (text, 8, "%d", backdate);
 	drivel_request_add_items (dr,
 			curl_escape ("prop_opt_backdated", 0), g_strdup (text), NULL);
+
+	/* some servers do not support this property, so only set if necessary */
+	if (taglist && strlen(taglist) != 0)
+	{
+		drivel_request_add_items (dr, 
+				g_strdup ("prop_taglist"), curl_escape (taglist, 0), NULL);
+	}
 	
 	if (journal)
 	{
@@ -569,7 +576,7 @@ blog_lj_build_editevent_request (const g
 		const gchar *mood, gint moodid, const gchar *subject, 
 		const gchar *security, gint mask, const gchar *picture, gint year, 
 		gint month, gint day, gboolean newdate, gint nocomments, 
-		gint preformatted, const DrivelJournal *dj)
+		gint preformatted, const DrivelJournal *dj, const gchar *taglist)
 {
 	DrivelRequest *dr;
 	const gchar *journal;
@@ -629,6 +636,13 @@ blog_lj_build_editevent_request (const g
 				g_strdup ("day"), g_strdup (text), NULL);
 	}
 	
+	/* some servers do not support this property, so only set if necessary */
+	if (taglist && strlen(taglist) != 0)
+	{
+		drivel_request_add_items (dr, 
+				g_strdup ("prop_taglist"), curl_escape (taglist, 0), NULL);
+	}
+	
 	if (journal)
 	{
 		drivel_request_add_items (dr, 
@@ -751,7 +765,7 @@ blog_lj_parse_getevents_request (DrivelC
 	gchar **itemid, **new_event, key [32];
 	gchar **old_event, **security, **allowmask, **subject;
 	gchar **eventtime, **comments = NULL, **autoformat = NULL;
-	gchar **mood = NULL, **music = NULL, **picture = NULL;
+	gchar **mood = NULL, **music = NULL, **taglist = NULL, **picture = NULL;
 	gint prop_count, events_count, i, j;
 	
 	mesg = drivel_request_value_lookup (dr, "success");
@@ -778,6 +792,7 @@ blog_lj_parse_getevents_request (DrivelC
 	picture = g_new (gchar *, events_count + 1);
 	mood = g_new (gchar *, events_count + 1);
 	music = g_new (gchar *, events_count + 1);
+	taglist = g_new (gchar *, events_count + 1);
 	comments = g_new (gchar *, events_count + 1);
 	autoformat = g_new (gchar *, events_count + 1);
 	
@@ -793,6 +808,7 @@ blog_lj_parse_getevents_request (DrivelC
 		picture [i] = NULL;
 		mood [i] = NULL;
 		music [i] = NULL;
+		taglist [i] = NULL;
 		comments [i] = NULL;
 		autoformat [i] = NULL;
 	}
@@ -837,6 +853,8 @@ blog_lj_parse_getevents_request (DrivelC
 				mood [i] = g_strdup (drivel_request_value_lookup (dr, key));
 			else if (!strcmp (mesg, "current_music"))
 				music [i] = g_strdup (drivel_request_value_lookup (dr, key));
+			else if (!strcmp (mesg, "taglist"))
+				taglist [i] = g_strdup (drivel_request_value_lookup (dr, key));
 			else if (!strcmp (mesg, "opt_nocomments"))
 				comments [i] = g_strdup (drivel_request_value_lookup (dr, key));
 			else if (!strcmp (mesg, "opt_preformatted"))
@@ -879,6 +897,13 @@ blog_lj_parse_getevents_request (DrivelC
 				prop->value = g_strdup (picture[i]);
 				g_array_append_val (entry->properties, prop);
 			}
+			if (taglist[i])
+			{
+				prop = journal_prop_new ();
+				prop->name = g_strdup ("taglist");
+				prop->value = g_strdup (picture[i]);
+				g_array_append_val (entry->properties, prop);
+			}
 			if (comments[i])
 			{
 				prop = journal_prop_new ();
@@ -907,7 +932,7 @@ blog_lj_parse_getevents_request (DrivelC
 	{	
 		journal_edit_entry (dc, itemid [0], new_event [0], security [0], 
 				allowmask [0], subject [0],	mood [0], music [0], picture [0], 
-				eventtime [0], comments [0], autoformat [0], NULL);
+				eventtime [0], comments [0], autoformat [0], NULL, taglist [0]);
 	}
 	else
 		update_history_list (dc, itemid, new_event, eventtime, events_count);
@@ -922,6 +947,7 @@ blog_lj_parse_getevents_request (DrivelC
 	g_strfreev (picture);
 	g_strfreev (mood);
 	g_strfreev (music);
+	g_strfreev (taglist);
 	g_strfreev (comments);
 	g_strfreev (autoformat);
 	
Index: src/blog_lj.h
===================================================================
RCS file: /cvs/gnome/drivel/src/blog_lj.h,v
retrieving revision 1.6
diff -p -u -r1.6 blog_lj.h
--- src/blog_lj.h	25 Jun 2005 16:19:28 -0000	1.6
+++ src/blog_lj.h	7 Aug 2005 00:39:23 -0000
@@ -51,7 +51,7 @@ blog_lj_build_postevent_request (const g
 		gint moodid, const gchar *subject, const gchar *security, gint mask,
 		const gchar *picture, gint year, gint month, gint day, gint hour,
 		gint minute, gint nocomments, gint preformatted, 
-		const DrivelJournal *dj, gint backdate);
+		const DrivelJournal *dj, gint backdate, const gchar *taglist);
 		
 DrivelRequest*
 blog_lj_build_editevent_request (const gchar *username, const gchar *uri, 
@@ -59,7 +59,7 @@ blog_lj_build_editevent_request (const g
 		const gchar *mood, gint moodid, const gchar *subject, 
 		const gchar *security, gint mask, const gchar *picture, gint year, 
 		gint month, gint day, gboolean newdate, gint nocomments, 
-		gint preformatted, const DrivelJournal *dj);
+		gint preformatted, const DrivelJournal *dj, const gchar *taglist);
 
 void
 blog_lj_parse_postevent_request (DrivelClient *dc, DrivelRequest *dr);
Index: src/blog_mt.c
===================================================================
RCS file: /cvs/gnome/drivel/src/blog_mt.c,v
retrieving revision 1.27
diff -p -u -r1.27 blog_mt.c
--- src/blog_mt.c	19 May 2005 21:59:00 -0000	1.27
+++ src/blog_mt.c	7 Aug 2005 00:39:23 -0000
@@ -556,7 +556,7 @@ blog_mt_parse_getevents_request (DrivelC
 			DrivelRequest *dr;
 			
 			journal_edit_entry (dc, postid, content, NULL, NULL, title, NULL,
-					NULL, NULL, NULL, NULL, NULL, NULL);
+					NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 			
 			dr = blog_mt_build_getpostcategories_request (dc->user->username,
 					dc->user->password, dc->user->server, postid);
Index: src/drivel.glade
===================================================================
RCS file: /cvs/gnome/drivel/src/drivel.glade,v
retrieving revision 1.55
diff -p -u -r1.55 drivel.glade
--- src/drivel.glade	9 Jul 2005 16:03:55 -0000	1.55
+++ src/drivel.glade	7 Aug 2005 00:39:27 -0000
@@ -344,6 +344,82 @@
 			      <property name="fill">False</property>
 			    </packing>
 			  </child>
+
+			  <child>
+			    <widget class="GtkHBox" id="options_taglist_box">
+			      <property name="visible">True</property>
+			      <property name="homogeneous">False</property>
+			      <property name="spacing">12</property>
+
+			      <child>
+				<widget class="GtkHBox" id="options_taglist_label_box">
+				  <property name="visible">True</property>
+				  <property name="homogeneous">False</property>
+				  <property name="spacing">6</property>
+
+				  <child>
+				    <widget class="GtkLabel" id="taglist_label">
+				      <property name="visible">True</property>
+				      <property name="label" translatable="yes">Tag_s:</property>
+				      <property name="use_underline">True</property>
+				      <property name="use_markup">False</property>
+				      <property name="justify">GTK_JUSTIFY_LEFT</property>
+				      <property name="wrap">False</property>
+				      <property name="selectable">False</property>
+				      <property name="xalign">0</property>
+				      <property name="yalign">0.5</property>
+				      <property name="xpad">0</property>
+				      <property name="ypad">0</property>
+				      <property name="mnemonic_widget">music</property>
+				      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+				      <property name="width_chars">-1</property>
+				      <property name="single_line_mode">False</property>
+				      <property name="angle">0</property>
+				    </widget>
+				    <packing>
+				      <property name="padding">0</property>
+				      <property name="expand">False</property>
+				      <property name="fill">False</property>
+				    </packing>
+				  </child>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkEventBox" id="options_taglist_eventbox">
+				  <property name="visible">True</property>
+				  <property name="events">GDK_ENTER_NOTIFY_MASK</property>
+				  <property name="visible_window">True</property>
+				  <property name="above_child">False</property>
+
+				  <child>
+				    <widget class="GtkComboBoxEntry" id="taglist">
+				      <property name="visible">True</property>
+				      <property name="items"></property>
+				      <property name="add_tearoffs">False</property>
+				      <property name="has_frame">True</property>
+				      <property name="focus_on_click">True</property>
+				    </widget>
+				  </child>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">True</property>
+				  <property name="fill">True</property>
+				</packing>
+			      </child>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">True</property>
+			      <property name="fill">True</property>
+			    </packing>
+			  </child>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
Index: src/drivel.h
===================================================================
RCS file: /cvs/gnome/drivel/src/drivel.h,v
retrieving revision 1.55
diff -p -u -r1.55 drivel.h
--- src/drivel.h	30 May 2005 03:25:35 -0000	1.55
+++ src/drivel.h	7 Aug 2005 00:39:27 -0000
@@ -96,6 +96,7 @@ struct _DrivelIDs
 	/* gconf ids */
 	guint mood_id;
 	guint music_id;
+	guint taglist_id;
 	guint picture_id;
 	guint security_id;
 	guint security_mask_id;
@@ -126,6 +127,7 @@ struct _DrivelGConfData
 	/* journal entry preferences */
 	gchar *default_mood;
 	gchar *default_music;
+	gchar *default_taglist;
 	gchar *default_picture;
 	gchar *default_security;
 	gchar *default_security_mask;
@@ -209,6 +211,7 @@ struct _DrivelClient
 	GtkWidget *journal_subject;
 	GtkWidget *journal_mood;
 	GtkWidget *journal_music;
+	GtkWidget *journal_taglist;
 	GtkWidget *journal_text;
 	GtkWidget *journal_security;
 	GtkWidget *journal_expander;
Index: src/journal.c
===================================================================
RCS file: /cvs/gnome/drivel/src/journal.c,v
retrieving revision 1.127
diff -p -u -r1.127 journal.c
--- src/journal.c	25 Jun 2005 16:19:28 -0000	1.127
+++ src/journal.c	7 Aug 2005 00:39:27 -0000
@@ -176,7 +176,7 @@ journal_entry_get_prop (DrivelJournalEnt
 static void
 recent_entry_cb (GtkAction *action, gpointer data)
 {
-	gchar *mood, *music, *picture, *eventtime, *comments, *autoformat;
+	gchar *mood, *music, *picture, *eventtime, *comments, *autoformat, *taglist;
 	DrivelJournalEntry *entry = (DrivelJournalEntry*) data;
 	DrivelClient *dc = g_object_get_data (G_OBJECT (action), "dc");
 	
@@ -186,10 +186,11 @@ recent_entry_cb (GtkAction *action, gpoi
 	eventtime = journal_entry_get_prop (entry, "eventtime");
 	comments = journal_entry_get_prop (entry, "comments");
 	autoformat = journal_entry_get_prop (entry, "autoformat");
+	taglist = journal_entry_get_prop (entry, "taglist");
 	
 	journal_edit_entry (dc, entry->postid, entry->content, entry->security, 
 				entry->security_mask, entry->subject, mood, music, picture, 
-				eventtime, comments, autoformat, entry->link);
+				eventtime, comments, autoformat, entry->link, taglist);
 	
 	return;
 }
@@ -1157,7 +1158,7 @@ autosave_cb (gpointer data)
 static void
 post_entry (DrivelClient *dc, DrivelRequestType mode)
 {
-	gchar *text, *mood, *mesg;
+	gchar *text, *mood, *mesg, *taglist;
 	gchar *music, *subject, *pic, *security, *key;
 	GtkTextIter start, end;
 	GtkTextBuffer *buffer;
@@ -1176,6 +1177,7 @@ post_entry (DrivelClient *dc, DrivelRequ
 	
 	mood = gtk_editable_get_chars (GTK_EDITABLE (GTK_BIN (dc->journal_mood)->child), 0, -1);
 	music = gtk_editable_get_chars (GTK_EDITABLE (GTK_BIN (dc->journal_music)->child), 0, -1);
+	taglist = gtk_editable_get_chars (GTK_EDITABLE (GTK_BIN (dc->journal_taglist)->child), 0, -1);
 	subject = gtk_editable_get_chars (GTK_EDITABLE (dc->journal_subject), 0, -1);
 	if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (dc->journal_security), &iter))
 	{
@@ -1240,7 +1242,7 @@ post_entry (DrivelClient *dc, DrivelRequ
 							subject, security, allowmask, pic, dc->time.year, 
 							dc->time.month, dc->time.day, dc->time.hour, 
 							dc->time.minute, no_comments, autoformat, 
-							dc->active_journal, backdate);
+							dc->active_journal, backdate, taglist);
 					break;
 				}
 				case BLOG_API_MT:
@@ -1291,7 +1293,7 @@ post_entry (DrivelClient *dc, DrivelRequ
 							music, mood, mood_id, subject, security, allowmask, 
 							pic, dc->time.year, dc->time.month, dc->time.day, 
 							backdate, no_comments, autoformat, 
-							dc->active_journal);
+							dc->active_journal, taglist);
 					break;
 				}
 				case BLOG_API_BLOGGER:
@@ -1439,6 +1441,10 @@ journal_display_defaults (DrivelClient *
 	string = get_default_text (dc->client, dc->gconf->default_music, "");
 	gtk_entry_set_text (GTK_ENTRY (GTK_BIN (dc->journal_music)->child), string);
 	g_free (string);
+
+	string = get_default_text (dc->client, dc->gconf->default_taglist, "");
+	gtk_entry_set_text (GTK_ENTRY (GTK_BIN (dc->journal_taglist)->child), string);
+	g_free (string);
 	
 	gtk_combo_box_set_active (GTK_COMBO_BOX (dc->journal_picture),
 			gconf_client_get_int (dc->client, dc->gconf->default_picture, NULL));
@@ -1509,7 +1515,7 @@ journal_display_defaults (DrivelClient *
 void
 journal_edit_entry (DrivelClient *dc, const gchar *itemid, const gchar *event, const gchar *security,
 		const gchar *allowmask, const gchar *subject, const gchar *mood, const gchar *music, const gchar *picture,
-		const gchar *eventtime, const gchar *comments, const gchar *autoformat, const gchar *link)
+		const gchar *eventtime, const gchar *comments, const gchar *autoformat, const gchar *link, const gchar *taglist)
 {
 	gboolean bool_comments, bool_autoformat;
 	gchar time [5], *pickw, *text;
@@ -1580,12 +1586,15 @@ journal_edit_entry (DrivelClient *dc, co
 		mood = g_strdup ("");
 	if (!music)
 		music = g_strdup ("");
+	if (!taglist)
+		taglist = g_strdup ("");
 		
 	gtk_text_buffer_set_text (dc->buffer, event, -1);
 	
 	gtk_entry_set_text (GTK_ENTRY (dc->journal_subject), subject);
 	gtk_entry_set_text (GTK_ENTRY (GTK_BIN (dc->journal_mood)->child), mood);
 	gtk_entry_set_text (GTK_ENTRY (GTK_BIN (dc->journal_music)->child), music);
+	gtk_entry_set_text (GTK_ENTRY (GTK_BIN (dc->journal_taglist)->child), taglist);
 	
 	if (itemid)
 		dc->journal_entry->postid = g_strdup (itemid);
@@ -1934,6 +1943,23 @@ mood_changed_cb (GConfClient *client, gu
 }
 
 static void
+taglist_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
+{
+	GConfValue *value;
+	const gchar *string;
+	DrivelClient *dc = (DrivelClient *) data;
+	
+	value = gconf_entry_get_value (entry);
+	string = gconf_value_get_string (value);
+
+	if (dc->journal_taglist)
+		gtk_entry_set_text (GTK_ENTRY (GTK_BIN (dc->journal_taglist)->child),
+				string);
+	
+	return;
+}
+
+static void
 music_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
 {
 	GConfValue *value;
@@ -2461,6 +2487,8 @@ add_gconf_notifies (DrivelClient *dc)
 			dc, NULL, NULL);
 	dc->id.music_id = gconf_client_notify_add (dc->client, dc->gconf->default_music, music_changed_cb,
 			dc, NULL, NULL);
+	dc->id.taglist_id = gconf_client_notify_add (dc->client, dc->gconf->default_taglist, taglist_changed_cb,
+			dc, NULL, NULL);
 	dc->id.picture_id = gconf_client_notify_add (dc->client, dc->gconf->default_picture, picture_changed_cb,
 			dc, NULL, NULL);
 	dc->id.security_id = gconf_client_notify_add (dc->client, dc->gconf->default_security, security_changed_cb,
@@ -3493,7 +3521,7 @@ journal_window_build (DrivelClient *dc)
 	 * written by Davyd Madeley <davyd ucc asn au>
 	 */
 	GladeXML *xml;
-	GtkWidget *window, *subject, *security, *mood, *music, *comment, *autoformat, *picture;
+	GtkWidget *window, *subject, *security, *mood, *music, *taglist, *comment, *autoformat, *picture;
 	GtkWidget *text_area, *menubar, *backdate, *date;
 	GtkWidget *post_button, *cancel_button, *delete_button, *save_button, *help_button;
 	GtkWidget *save_draft_button, *widget, *options_lj, *options_mt;
@@ -3625,7 +3653,12 @@ journal_window_build (DrivelClient *dc)
 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (music), renderer,
 			"text", 0,
 			NULL);
-	
+
+	/* the tags entry */
+	widget = glade_xml_get_widget (xml, "taglist_label");
+	gtk_size_group_add_widget (col1, widget);
+	taglist = glade_xml_get_widget (xml, "taglist");
+
 	/* no comments check */
 	comment = glade_xml_get_widget (xml, "nocomments");
 	gtk_size_group_add_widget (row1, comment);
@@ -3691,6 +3724,7 @@ journal_window_build (DrivelClient *dc)
 	dc->journal_subject = subject;
 	dc->journal_mood = mood;
 	dc->journal_music = music;
+	dc->journal_taglist = taglist;
 	dc->journal_security = security;
 	dc->journal_picture = picture;
 	dc->journal_comment = comment;
Index: src/journal.h
===================================================================
RCS file: /cvs/gnome/drivel/src/journal.h,v
retrieving revision 1.9
diff -p -u -r1.9 journal.h
--- src/journal.h	9 May 2005 21:08:14 -0000	1.9
+++ src/journal.h	7 Aug 2005 00:39:27 -0000
@@ -35,7 +35,7 @@ journal_edit_entry (DrivelClient *dc, co
 		const gchar *security, const gchar *allowmask, const gchar *subject, 
 		const gchar *mood, const gchar *music, const gchar *picture,
 		const gchar *eventtime, const gchar *comments, const gchar *autoformat, 
-		const gchar *link);
+		const gchar *link, const gchar *taglist);
 
 void
 journal_edit_entry_finished (DrivelClient *dc);
Index: src/main.c
===================================================================
RCS file: /cvs/gnome/drivel/src/main.c,v
retrieving revision 1.58
diff -p -u -r1.58 main.c
--- src/main.c	9 Jul 2005 03:59:53 -0000	1.58
+++ src/main.c	7 Aug 2005 00:39:28 -0000
@@ -469,6 +469,7 @@ gconf_data_free (DrivelGConfData *data, 
 	
 	g_free (data->default_mood);
 	g_free (data->default_music);
+	g_free (data->default_taglist);
 	g_free (data->default_picture);
 	g_free (data->default_security);
 	g_free (data->default_security_mask);
@@ -515,6 +516,7 @@ drivel_gconf_data_fill (DrivelGConfData 
 	
 	data->default_mood = g_strdup_printf ("%s/default_mood", base);
 	data->default_music = g_strdup_printf ("%s/default_music", base);
+	data->default_taglist = g_strdup_printf ("%s/default_taglist", base);
 	data->default_picture = g_strdup_printf ("%s/default_picture", base);
 	data->default_security = g_strdup_printf ("%s/default_security_name", base);
 	data->default_security_mask = g_strdup_printf ("%s/default_security_mask", base);
Index: src/query_music_players.c
===================================================================
RCS file: /cvs/gnome/drivel/src/query_music_players.c,v
retrieving revision 1.8
diff -p -u -r1.8 query_music_players.c
--- src/query_music_players.c	11 Jan 2005 00:21:18 -0000	1.8
+++ src/query_music_players.c	7 Aug 2005 00:39:28 -0000
@@ -52,6 +52,9 @@ static gboolean
 rhythmbox_init (gpointer **ptr);
 static gchar
 *rhythmbox_query (gpointer *ptr);
+
+static gchar
+*amarok_query (gpointer *ptr);
 /* ---- end definitions ---- */
 
 void
@@ -87,6 +90,10 @@ query_music_players (GtkListStore *playi
 		add_music_entry (playing, rhythmbox_query (ptr), pixbuf, &entries, FALSE);
 	}
 #endif
+#ifdef DCOP_PROGRAM
+	pixbuf = NULL;
+	add_music_entry (playing, amarok_query (ptr), pixbuf, &entries, FALSE);
+#endif
 	if (entries)
 		add_music_entry (playing, g_strdup (""), NULL, NULL, TRUE);
 	else
@@ -299,3 +306,44 @@ static gchar
 		return NULL;
 }
 #endif
+
+#ifdef DCOP_PROGRAM
+#include <stdio.h>
+
+#define DCOP_BUF_SIZE		1024
+
+static gchar
+*dcop_query (gchar *command)
+{
+	FILE *pipe;
+	gchar *cmd, *p;
+	char buf[DCOP_BUF_SIZE];
+	
+	cmd = g_strdup_printf("%s %s", DCOP_PROGRAM, command);
+	pipe = popen(cmd, "r");
+	if (!pipe)
+		return NULL;
+	memset(buf, 0, DCOP_BUF_SIZE);
+	fread(buf, DCOP_BUF_SIZE-1, 1, pipe);
+	pclose(pipe);
+	g_free(cmd);
+
+	p = buf;
+	while (*p) {
+		if (*p == '\n') {
+			*p = '\0';
+			break;
+		}
+		p++;
+	}
+
+	return g_strdup(buf);
+}
+
+static gchar
+*amarok_query (gpointer *ptr)
+{
+	return dcop_query("amarok player nowPlaying");
+}
+#endif
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]