2
* arch-tag: Nautilus context menu main implementation
3
* Copyright (C) 2003 Yann Rouillard
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License as
7
* published by the Free Software Foundation; either version 2 of the
8
* License, or (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more av.
15
* You should have received a copy of the GNU General Public
16
* License along with this program; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
20
* Author: Yann Rouillard <y.rouillard@laposte.net>
27
#include <libgnomevfs/gnome-vfs-utils.h>
28
#include <libbonobo.h>
29
#include "rb-nautilus-context-menu.h"
30
#include "Rhythmbox.h"
36
impl_Bonobo_Listener_event (PortableServer_Servant servant,
37
const CORBA_char *event_name,
38
const CORBA_any *args,
39
CORBA_Environment *ev)
41
RbNautilusContextMenu *rncm;
42
const CORBA_sequence_CORBA_string *list;
46
rncm = RB_NAUTILUS_CONTEXT_MENU (bonobo_object_from_servant (servant));
48
if (!CORBA_TypeCode_equivalent (args->_type, TC_CORBA_sequence_CORBA_string, ev))
51
list = (CORBA_sequence_CORBA_string *) args->_value;
53
g_return_if_fail (rncm != NULL);
54
g_return_if_fail (list != NULL);
56
obj = bonobo_activation_activate ("repo_ids.has ('IDL:GNOME/Rhythmbox:1.0')", NULL, 0, NULL, ev);
58
if (ev->_major != CORBA_NO_EXCEPTION)
61
g_return_if_fail (obj != CORBA_OBJECT_NIL);
63
for (i = 0; i < list->_length; i++) {
65
char *utf8 = g_filename_to_utf8 (list->_buffer[i], -1, NULL, NULL, &error);
66
if (utf8 && error == NULL)
67
GNOME_Rhythmbox_addToLibrary(obj, utf8, ev);
70
CORBA_Object_release (obj, ev);
74
/* initialize the class */
76
rb_nautilus_context_menu_class_init (RbNautilusContextMenuClass *class)
78
POA_Bonobo_Listener__epv *epv = &class->epv;
79
epv->event = impl_Bonobo_Listener_event;
84
rb_nautilus_context_menu_init (RbNautilusContextMenu *rncm)
89
BONOBO_TYPE_FUNC_FULL (RbNautilusContextMenu,
92
rb_nautilus_context_menu);