Commit a201b856 authored by Scott Reeves's avatar Scott Reeves

Fix system-items translation and redo entire flow

svn path=/trunk/; revision=535
parent 1daaeb0d
2008-12-31 Scott Reeves <sreeves@novell.com>
* main-menu/src/main-menu-ui.c
* main-menu/src/main-menu-migration.c
* main-menu/src/main-menu-migration.h
* main-menu/src/main-menu.c
* main-menu/etc/gnome-screensaver-lock.desktop
* main-menu/etc/gnome-session-kill.desktop
* main-menu/etc/system-items.xbel
* main-menu/etc/system-items.xbel.in
* main-menu/etc/gnome-session-logout.desktop
* main-menu/etc/gnome-session-shutdown.desktop
* main-menu/etc/Makefile.am
* libslab/bookmark-agent.c
* po/POTFILES.in:
Fix BNC#447550 - translations not updating when changing locale
Fix up the entire flow of how the system-items.xbel is handled
Title is now marked for translation directly in the .xbel file
Clean up old corrupted local system-items.xbel files and provide
a new updated default one.
2008-12-29 Scott Reeves <sreeves@novell.com>
* main-menu/src/network-status-tile.c
* main-menu/etc/slab.schemas.in.in
......
......@@ -1038,8 +1038,6 @@ create_app_item (BookmarkAgent *this, const gchar *uri)
GnomeDesktopItem *ditem;
gchar *uri_new = NULL;
gchar *name;
ditem = libslab_gnome_desktop_item_new_from_unknown_id (uri);
......@@ -1051,18 +1049,6 @@ create_app_item (BookmarkAgent *this, const gchar *uri)
if (! uri_new)
return;
name = g_bookmark_file_get_title (priv->store, uri, NULL);
if (! libslab_strcmp (name, "Help"))
g_bookmark_file_set_title (priv->store, uri, _("Help"));
else if (! libslab_strcmp (name, "Lock Screen"))
g_bookmark_file_set_title (priv->store, uri, _("Lock Screen"));
else if (! libslab_strcmp (name, "Logout"))
g_bookmark_file_set_title (priv->store, uri, _("Logout"));
else if (! libslab_strcmp (name, "Shutdown"))
g_bookmark_file_set_title (priv->store, uri, _("Shutdown"));
g_free (name);
if (libslab_strcmp (uri, uri_new))
g_bookmark_file_move_item (priv->store, uri, uri_new, NULL);
......
......@@ -10,11 +10,14 @@ uidir = $(datadir)/gnome-2.0/ui
ui_DATA = GNOME_MainMenu_ContextMenu.xml
desktopdir = $(datadir)/applications
desktop_DATA = gnome-screensaver-lock.desktop gnome-session-kill.desktop trigger-panel-run-dialog.desktop
desktop_DATA = gnome-screensaver-lock.desktop gnome-session-logout.desktop gnome-session-shutdown.desktop trigger-panel-run-dialog.desktop
@INTLTOOL_DESKTOP_RULE@
bookmarkdir = $(datadir)/gnome-main-menu
bookmark_DATA = applications.xbel documents.xbel system-items.xbel places.xbel empty.ots empty.ott
bookmark_DATA = applications.xbel documents.xbel places.xbel empty.ots empty.ott
systemitemsdir = $(datadir)/gnome-main-menu
systemitems_DATA = system-items.xbel
$(server_DATA).in: $(server_DATA).in.in
sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
......@@ -22,6 +25,9 @@ $(server_DATA).in: $(server_DATA).in.in
$(schemas_DATA).in: $(schemas_DATA).in.in
sed -e "s|\@DATADIR\@|$(datadir)|g" $< > $@
$(systemitems_DATA): $(systemitems_DATA).in
sed -e "s|_title>|title>|g" $< > $@
install-data-local:
if test -z "$(DESTDIR)" ; then \
for p in $(schemas_DATA) ; do \
......@@ -29,6 +35,6 @@ install-data-local:
done \
fi
EXTRA_DIST = $(server_DATA).in.in $(schemas_DATA).in.in $(ui_DATA) $(desktop_DATA) $(bookmark_DATA)
EXTRA_DIST = $(server_DATA).in.in $(schemas_DATA).in.in $(ui_DATA) $(desktop_DATA) $(bookmark_DATA) $(systemitems_DATA).in
CLEANFILES = $(server_DATA) $(schemas_DATA) $(server_DATA).in $(schemas_DATA).in
CLEANFILES = $(server_DATA) $(schemas_DATA) $(server_DATA).in $(schemas_DATA).in $(systemitems_DATA)
......@@ -8,3 +8,5 @@ Terminal=false
Type=Application
Categories=GNOME;Application;System
OnlyShowIn=GNOME;
Hidden=true
[Desktop Entry]
Name=Logout
Encoding=UTF-8
Version=1.0
Icon=gnome-logout
Exec=gnome-session-save --kill
Terminal=false
Type=Application
Categories=GNOME;Application;System
OnlyShowIn=GNOME;
[Desktop Entry]
Name=Session Logout Dialog
Comment=Prompt the user to log out of their session
Exec=gnome-session-save --logout-dialog
Terminal=false
Type=Application
Icon=system-log-out
Hidden=true
Categories=System;SystemSetup;
OnlyShowIn=GNOME;
[Desktop Entry]
Name=System Shutdown Dialog
Comment=Prompt the user to shutdown their computer
Exec=gnome-session-save --shutdown-dialog
Terminal=false
Type=Application
Icon=system-shutdown
Hidden=true
Categories=System;SystemSetup;
OnlyShowIn=GNOME;
......@@ -4,7 +4,7 @@
xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
<bookmark href="yelp.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<title>Help</title>
<_title>Help</_title>
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="application/x-desktop"/>
......@@ -30,13 +30,26 @@
</metadata>
</info>
</bookmark>
<bookmark href="package-manager.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<bookmark href="YaST.desktop" added="2008-06-04T15:58:58Z" modified="2008-06-04T15:58:58Z" visited="2008-06-04T15:58:58Z">
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="application/x-desktop"/>
<bookmark:groups>
<bookmark:group>rank-2</bookmark:group>
</bookmark:groups>
<bookmark:applications>
<bookmark:application name="YaST" exec="gnomesu -c /sbin/yast2" timestamp="1212587938" count="1"/>
</bookmark:applications>
</metadata>
</info>
</bookmark>
<bookmark href="package-manager.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="application/x-desktop"/>
<bookmark:groups>
<bookmark:group>rank-3</bookmark:group>
</bookmark:groups>
<bookmark:applications>
<bookmark:application name="Install Software" exec="package-manager %F" timestamp="1168926816" count="1"/>
</bookmark:applications>
......@@ -44,11 +57,12 @@
</info>
</bookmark>
<bookmark href="gnome-screensaver-lock.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<_title>Lock Screen</_title>
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="application/x-desktop"/>
<bookmark:groups>
<bookmark:group>rank-3</bookmark:group>
<bookmark:group>rank-4</bookmark:group>
</bookmark:groups>
<bookmark:applications>
<bookmark:application name="Lock Screen" exec="gnome-screensaver-command --lock" timestamp="1168926816" count="1"/>
......@@ -56,16 +70,30 @@
</metadata>
</info>
</bookmark>
<bookmark href="gnome-session-kill.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<title>Logout</title>
<bookmark href="gnome-session-logout.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<_title>Logout</_title>
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="application/x-desktop"/>
<bookmark:groups>
<bookmark:group>rank-4</bookmark:group>
<bookmark:group>rank-5</bookmark:group>
</bookmark:groups>
<bookmark:applications>
<bookmark:application name="Session Logout Dialog" exec="gnome-session-save" timestamp="1168926816" count="1"/>
</bookmark:applications>
</metadata>
</info>
</bookmark>
<bookmark href="gnome-session-shutdown.desktop" added="2007-01-16T05:53:36Z" modified="2007-01-16T05:53:36Z" visited="2007-01-16T05:53:36Z">
<_title>Shutdown</_title>
<info>
<metadata owner="http://freedesktop.org">
<mime:mime-type type="application/x-desktop"/>
<bookmark:groups>
<bookmark:group>rank-6</bookmark:group>
</bookmark:groups>
<bookmark:applications>
<bookmark:application name="Logout" exec="gnome-session-save --kill" timestamp="1168926816" count="1"/>
<bookmark:application name="Session Shutdown Dialog" exec="gnome-session-save" timestamp="1168926816" count="1"/>
</bookmark:applications>
</metadata>
</info>
......
......@@ -37,6 +37,7 @@
#include "libslab-utils.h"
#define SYSTEM_BOOKMARK_FILENAME "system-items.xbel"
#define SYSTEM_BOOKMARK_MIGRATED_TO_NEW_SET "system-items.migrated"
#define APPS_BOOKMARK_FILENAME "applications.xbel"
#define SYSTEM_ITEM_GCONF_KEY "/desktop/gnome/applications/main-menu/system-area/system_item_list"
......@@ -49,6 +50,43 @@
#define LOGOUT_DESKTOP_ITEM "gnome-session-kill.desktop"
void
move_system_area_to_new_set ()
{
/* for libslab 0.9.12 start with the new default system area because
* 1. We have significantly changed the default set and want these new values to show up
* 2. bug (BNC #447550) caused translated title entry to overwrite valid one
causing errors and a customized file when user did not explicitly want it
* 3. bug in the default system-items.xbel ranking also caused a customized file
again without the user explicitly wanting one.
*/
gchar * filename;
GFile *file;
GFileOutputStream *filestream;
filename = g_build_filename (
g_get_user_data_dir (), PACKAGE, SYSTEM_BOOKMARK_MIGRATED_TO_NEW_SET, NULL);
if (! g_file_test (filename, G_FILE_TEST_EXISTS))
{
file = g_file_new_for_path (filename);
filestream = g_file_create (file, G_FILE_CREATE_NONE, NULL, NULL);
if (filestream)
g_object_unref (filestream);
g_object_unref (file);
g_free (filename);
filename = g_build_filename (
g_get_user_data_dir (), PACKAGE, SYSTEM_BOOKMARK_FILENAME, NULL);
if (g_file_test (filename, G_FILE_TEST_EXISTS))
{
file = g_file_new_for_path (filename);
g_file_delete (file, NULL, NULL);
g_object_unref (file);
}
}
g_free (filename);
}
void
migrate_system_gconf_to_bookmark_file ()
{
......
......@@ -25,6 +25,7 @@
G_BEGIN_DECLS
void move_system_area_to_new_set (void);
void migrate_system_gconf_to_bookmark_file (void);
void migrate_user_apps_gconf_to_bookmark_file (void);
void migrate_showable_file_types (void);
......
......@@ -1130,13 +1130,17 @@ item_to_system_tile (BookmarkItem *item, gpointer data)
{
Tile *tile;
gchar *basename;
gchar *translated_title;
if (app_is_in_blacklist (item->uri))
return NULL;
translated_title = item->title ? _(item->title) : NULL;
tile = TILE (system_tile_new (item->uri, item->title));
tile = TILE (system_tile_new (item->uri, translated_title));
/* with 0.9.12 we start with clean system area - see move_system_area_to_new_set
no longer need this code to clean up old junk
if (tile)
return tile;
......@@ -1147,9 +1151,10 @@ item_to_system_tile (BookmarkItem *item, gpointer data)
basename = item->uri;
if (! libslab_strcmp (basename, "control-center.desktop"))
tile = TILE (system_tile_new ("gnomecc.desktop", item->title));
tile = TILE (system_tile_new ("gnomecc.desktop", translated_title));
else if (! libslab_strcmp (basename, "zen-installer.desktop"))
tile = TILE (system_tile_new ("package-manager.desktop", item->title));
tile = TILE (system_tile_new ("package-manager.desktop", translated_title));
*/
return tile;
}
......
......@@ -67,7 +67,8 @@ main_menu_applet_init (PanelApplet *applet, const gchar *iid, gpointer user_data
gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, 1, argv, NULL, NULL);
libslab_checkpoint ("Migrating old configurations");
migrate_system_gconf_to_bookmark_file ();
move_system_area_to_new_set ();
//migrate_system_gconf_to_bookmark_file ();
migrate_user_apps_gconf_to_bookmark_file ();
migrate_showable_file_types ();
......
......@@ -13,7 +13,6 @@ libslab/system-tile.c
main-menu/etc/GNOME_MainMenu.server.in.in
main-menu/etc/GNOME_MainMenu_ContextMenu.xml
main-menu/etc/gnome-screensaver-lock.desktop
main-menu/etc/gnome-session-kill.desktop
main-menu/etc/slab.schemas.in.in
main-menu/src/hard-drive-status-tile.c
main-menu/src/main-menu-migration.c
......@@ -21,3 +20,4 @@ main-menu/src/main-menu-ui.c
main-menu/src/network-status-tile.c
main-menu/src/slab-window.glade
nautilus-main-menu/nautilus-main-menu.c
[type: gettext/xml] main-menu/etc/system-items.xbel.in
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment