[monkey-bubble: 408/753] Moved here from ../libgnome.
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [monkey-bubble: 408/753] Moved here from ../libgnome.
- Date: Wed, 14 Jul 2010 22:29:57 +0000 (UTC)
commit 6a8c7154289918df15cccf5caa14c63b312a83fd
Author: Martin Baulig <baulig suse de>
Date: Sat Jun 9 23:31:53 2001 +0000
Moved here from ../libgnome.
2001-06-10 Martin Baulig <baulig suse de>
* gnome-desktop.xmldb: Moved here from ../libgnome.
* desktop-item-boot.c: New file. This is a small utility which you
need to run each time after doing a `make install'.
* bonobo-config-ditem-utils.c (bonobo_config_ditem_decode_any):
Added `BonoboConfigDatabase *ditem' and `const gchar *path' arguments.
Implemented TC_GNOME_ExtraAttributes.
monikers/.cvsignore | 1 +
monikers/ChangeLog | 11 +++++++
monikers/desktop-item-boot.c | 60 ++++++++++++++++++++++++++++++++++++++++++
monikers/test-ditem.c | 32 +++++++++++++++++++---
4 files changed, 99 insertions(+), 5 deletions(-)
---
diff --git a/monikers/.cvsignore b/monikers/.cvsignore
index 50d22b5..040c8c3 100644
--- a/monikers/.cvsignore
+++ b/monikers/.cvsignore
@@ -6,3 +6,4 @@ Makefile
*.lo
*.oaf
test-ditem
+desktop-item-boot
diff --git a/monikers/ChangeLog b/monikers/ChangeLog
index 9807ac7..14bc7a0 100644
--- a/monikers/ChangeLog
+++ b/monikers/ChangeLog
@@ -1,3 +1,14 @@
+2001-06-10 Martin Baulig <baulig suse de>
+
+ * gnome-desktop.xmldb: Moved here from ../libgnome.
+
+ * desktop-item-boot.c: New file. This is a small utility which you
+ need to run each time after doing a `make install'.
+
+ * bonobo-config-ditem-utils.c (bonobo_config_ditem_decode_any):
+ Added `BonoboConfigDatabase *ditem' and `const gchar *path' arguments.
+ Implemented TC_GNOME_ExtraAttributes.
+
2001-06-09 Martin Baulig <baulig suse de>
* bonobo-config-ditem-utils.c (bonobo_config_ditem_decode_any):
diff --git a/monikers/desktop-item-boot.c b/monikers/desktop-item-boot.c
new file mode 100644
index 0000000..d7ce611
--- /dev/null
+++ b/monikers/desktop-item-boot.c
@@ -0,0 +1,60 @@
+/* -*- Mode: C; c-set-style: gnu indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+#include <libbonobo.h>
+#include <libgnome/Gnome.h>
+
+static void
+boot_ditem (Bonobo_ConfigDatabase db)
+{
+ BonoboArg *arg;
+ CORBA_Environment ev;
+
+ arg = bonobo_arg_new (TC_GNOME_DesktopEntry);
+ bonobo_pbclient_set_value (db, "/Desktop Entry", arg, NULL);
+ bonobo_arg_release (arg);
+
+ arg = bonobo_arg_new (TC_CORBA_long);
+ bonobo_pbclient_set_value (db, "/Desktop Entry/X-GNOME-Long", arg, NULL);
+ bonobo_arg_release (arg);
+
+ /* For some strange reason, this function causes the config moniker
+ * (bonobo-config-xmldb) to crash after successfully writing the file.
+ * So call this function to initialize the file and the comment it out.
+ */
+
+ CORBA_exception_init (&ev);
+ Bonobo_ConfigDatabase_sync (db, &ev);
+ g_assert (!BONOBO_EX (&ev));
+ CORBA_exception_free (&ev);
+}
+
+int
+main (int argc, char **argv)
+{
+ Bonobo_ConfigDatabase db = NULL;
+ Bonobo_ConfigDatabase default_db = NULL;
+ Bonobo_KeyList *dirlist, *keylist;
+ CORBA_Environment ev;
+ CORBA_TypeCode type;
+ CORBA_any *value;
+ guint i, j;
+
+ CORBA_exception_init (&ev);
+
+ if (bonobo_init (&argc, argv) == FALSE)
+ g_error ("Cannot init bonobo");
+
+ bonobo_activate ();
+
+
+ CORBA_exception_init (&ev);
+ default_db = bonobo_get_object ("xmldb:" LIBGNOME_SYSCONFDIR "/gnome-2.0/gnome-desktop.xmldb",
+ "Bonobo/ConfigDatabase", &ev);
+ g_assert (!BONOBO_EX (&ev));
+ CORBA_exception_free (&ev);
+
+ g_assert (default_db != NULL);
+
+ boot_ditem (default_db);
+
+ exit (0);
+}
diff --git a/monikers/test-ditem.c b/monikers/test-ditem.c
index 8822869..332271c 100644
--- a/monikers/test-ditem.c
+++ b/monikers/test-ditem.c
@@ -2,6 +2,7 @@
#include <libbonobo.h>
#include <libgnome/Gnome.h>
#include <libgnome/gnome-ditem.h>
+#include <locale.h>
#include "bonobo-config-ditem.h"
@@ -29,7 +30,9 @@ static void G_GNUC_UNUSED
test_ditem (Bonobo_ConfigDatabase db)
{
GnomeDesktopItem *ditem;
+ GNOME_DesktopEntryType type;
const gchar *text;
+ GSList *list, *c;
ditem = gnome_desktop_item_new_from_file ("/home/martin/work/test.desktop",
GNOME_DESKTOP_ITEM_LOAD_ONLY_IF_EXISTS);
@@ -37,8 +40,8 @@ test_ditem (Bonobo_ConfigDatabase db)
text = gnome_desktop_item_get_location (ditem);
g_print ("LOCATION: |%s|\n", text);
- text = gnome_desktop_item_get_type (ditem);
- g_print ("TYPE: |%s|\n", text);
+ type = gnome_desktop_item_get_type (ditem);
+ g_print ("TYPE: |%d|\n", type);
text = gnome_desktop_item_get_command (ditem);
g_print ("COMMAND: |%s|\n", text);
@@ -52,12 +55,24 @@ test_ditem (Bonobo_ConfigDatabase db)
text = gnome_desktop_item_get_name (ditem, "de");
g_print ("NAME (de): |%s|\n", text);
+ text = gnome_desktop_item_get_local_name (ditem);
+ g_print ("LOCAL NAME: |%s|\n", text);
+
text = gnome_desktop_item_get_comment (ditem, NULL);
g_print ("COMMENT: |%s|\n", text);
text = gnome_desktop_item_get_comment (ditem, "de");
g_print ("COMMENT (de): |%s|\n", text);
+ text = gnome_desktop_item_get_local_comment (ditem);
+ g_print ("LOCAL COMMENT: |%s|\n", text);
+
+ list = gnome_desktop_item_get_attributes (ditem);
+ for (c = list; c; c = c->next) {
+ const gchar *attr = c->data;
+
+ g_print ("ATTRIBUTE: |%s|\n", attr);
+ }
}
int
@@ -73,10 +88,19 @@ main (int argc, char **argv)
CORBA_exception_init (&ev);
+ setlocale (LC_ALL, "");
+
if (bonobo_init (&argc, argv) == FALSE)
g_error ("Cannot init bonobo");
- db = bonobo_config_ditem_new ("~/work/test.desktop");
+ bonobo_activate ();
+
+ // db = bonobo_config_ditem_new ("~/work/test.desktop");
+
+ CORBA_exception_init (&ev);
+ db = bonobo_get_object ("ditem:~/work/test.desktop", "Bonobo/ConfigDatabase", &ev);
+ g_assert (!BONOBO_EX (&ev));
+ CORBA_exception_free (&ev);
CORBA_exception_init (&ev);
default_db = bonobo_get_object ("xmldb:~/work/foo.xml", "Bonobo/ConfigDatabase", &ev);
@@ -86,8 +110,6 @@ main (int argc, char **argv)
g_assert (db != NULL);
g_assert (default_db != NULL);
- // boot_ditem (default_db);
-
test_ditem (db);
CORBA_exception_init (&ev);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]