quick-lounge-applet r244 - in trunk: . src



Author: paobac
Date: Mon Feb  2 17:26:41 2009
New Revision: 244
URL: http://svn.gnome.org/viewvc/quick-lounge-applet?rev=244&view=rev

Log:
2009-02-02  Paolo Bacchilega  <paobac svn gnome org>

	* src/file-utils.c (_g_key_file_cleanup): 

	remove the X-Ubuntu-Gettext-Domain from the key_file.

2009-02-02  Paolo Bacchilega  <paobac svn gnome org>

	* src/quick-box.c: 
	* src/qck-desktop-entry-dialog.c: 
	* src/file-utils.h: 
	* src/file-utils.c: 
	
	no need to use a personalized g_key_file_get_locale_string function.


Modified:
   trunk/ChangeLog
   trunk/src/file-utils.c
   trunk/src/file-utils.h
   trunk/src/qck-desktop-entry-dialog.c
   trunk/src/quick-box.c
   trunk/src/quick-lounge.c

Modified: trunk/src/file-utils.c
==============================================================================
--- trunk/src/file-utils.c	(original)
+++ trunk/src/file-utils.c	Mon Feb  2 17:26:41 2009
@@ -586,6 +586,14 @@
 }
 
 
+void
+_g_key_file_cleanup (GKeyFile *file)
+{
+	/* workaround for a bug in Ubuntu */
+	g_key_file_remove_key (file, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL);
+}
+
+
 GKeyFile *
 _g_key_file_dup (GKeyFile *file)
 {
@@ -598,7 +606,7 @@
 		gsize  length;
 		 	
 		data = g_key_file_to_data (file, &length, NULL);
-		g_key_file_load_from_data (new_file, data, length, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
+		g_key_file_load_from_data (new_file, data, length, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);		
 			
 		g_free (data);
 	}
@@ -609,46 +617,15 @@
 }
 
 
-char *
-_g_key_file_get_locale_string (GKeyFile    *file,
-			       const char  *group_name,
-                               const char  *key,
-                               char       **languages,
-                               GError     **error)
-{
-	char *value = NULL;
-	int   i;
-	
-	for (i = 0; (value == NULL) && (languages[i] != NULL); i++) {
-		const char *locale;
-		
-		if (strcmp (languages[i], "C") == 0)
-			locale = NULL;
-		else
-			locale = languages[i];
-		
-		if (error != NULL)
-			g_clear_error (error);		
-		
-		value = g_key_file_get_locale_string (file, group_name, key, locale, error);		
-	}
-	
-	return value;
-}
-
-
 gboolean
 _g_desktop_entry_equal (GKeyFile *file1,
 			GKeyFile *file2)
 {
-	char     **languages;
 	gboolean   terminal1;
 	char      *value1;
 	gboolean   terminal2;
 	char      *value2;
 	
-	languages = (char **) g_get_language_names ();
-	
 	terminal1 = g_key_file_get_boolean (file1, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TERMINAL, NULL);
 	terminal2 = g_key_file_get_boolean (file2, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TERMINAL, NULL);	
 	if (terminal1 != terminal2) 
@@ -662,8 +639,8 @@
 		return FALSE;
 	}
 	
-	value1 = _g_key_file_get_locale_string (file1, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, languages, NULL);
-	value2 = _g_key_file_get_locale_string (file2, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, languages, NULL);
+	value1 = g_key_file_get_locale_string (file1, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
+	value2 = g_key_file_get_locale_string (file2, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
 	if (g_strcmp0 (value1, value2) != 0) {
 		g_free (value1);
 		g_free (value2);
@@ -678,8 +655,8 @@
 		return FALSE;
 	}
 	
-	value1 = _g_key_file_get_locale_string (file1, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, languages, NULL);
-	value2 = _g_key_file_get_locale_string (file2, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, languages, NULL);
+	value1 = g_key_file_get_locale_string (file1, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
+	value2 = g_key_file_get_locale_string (file2, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
 	if (g_strcmp0 (value1, value2) != 0) {
 		g_free (value1);
 		g_free (value2);

Modified: trunk/src/file-utils.h
==============================================================================
--- trunk/src/file-utils.h	(original)
+++ trunk/src/file-utils.h	Mon Feb  2 17:26:41 2009
@@ -66,11 +66,7 @@
 						   GCancellable      *cancellable,
 						   GError           **error);
 GKeyFile *          _g_key_file_dup               (GKeyFile          *file);
-char *              _g_key_file_get_locale_string (GKeyFile          *file,
-						   const char        *group_name,
-                                                   const char        *key,
-                                                   char             **languages,
-                                                   GError            **error);
+void                _g_key_file_cleanup           (GKeyFile          *file);
 gboolean            _g_desktop_entry_equal        (GKeyFile          *file1,
 						   GKeyFile          *file2);
 

Modified: trunk/src/qck-desktop-entry-dialog.c
==============================================================================
--- trunk/src/qck-desktop-entry-dialog.c	(original)
+++ trunk/src/qck-desktop-entry-dialog.c	Mon Feb  2 17:26:41 2009
@@ -360,18 +360,15 @@
 qck_desktop_entry_dialog_update (QckDesktopEntryDialog *self,
 				 GKeyFile              *entry)
 {
-	char     **languages;
 	gboolean   terminal;
 	char      *name;
 	char      *exec;
 	char      *comment;
 	
-	languages = (char **) g_get_language_names ();
-	
 	terminal = g_key_file_get_boolean (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_TERMINAL, NULL);
-	name = _g_key_file_get_locale_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, languages, NULL);
+	name = g_key_file_get_locale_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
 	exec = g_key_file_get_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_EXEC, NULL);
-	comment = _g_key_file_get_locale_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, languages, NULL);
+	comment = g_key_file_get_locale_string (entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
 	
 	gtk_combo_box_set_active (GTK_COMBO_BOX (self->priv->type_combobox), terminal ? 1 : 0);
 	gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("name_entry")), name ? name : "");

Modified: trunk/src/quick-box.c
==============================================================================
--- trunk/src/quick-box.c	(original)
+++ trunk/src/quick-box.c	Mon Feb  2 17:26:41 2009
@@ -1171,7 +1171,6 @@
 	GtkWidget  *item;
 	GList      *children = NULL, *scan;
 	gboolean    menu_empty = TRUE;
-	char      **languages;
 	
 	if (quick_box->priv->popup_menu != NULL) {
 		gtk_menu_shell_deactivate (GTK_MENU_SHELL (quick_box->priv->popup_menu));
@@ -1179,8 +1178,6 @@
 		return;
 	}
 
-	languages = (char **) g_get_language_names ();
-
 	children = gtk_container_get_children (GTK_CONTAINER (quick_box));
 
 	for (scan = children; scan; scan = scan->next) {
@@ -1224,7 +1221,7 @@
 
 		/**/
 
-		name = _g_key_file_get_locale_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, languages, NULL); 
+		name = g_key_file_get_locale_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL); 
 		item = gtk_image_menu_item_new_with_label (name);
 
 		icon = g_key_file_get_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
@@ -1235,7 +1232,7 @@
 
 		/**/
 
-		comment = _g_key_file_get_locale_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, languages, NULL);
+		comment = g_key_file_get_locale_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
 		
 		if ((comment != NULL) && (strcmp (comment, "") != 0))
 			tip = g_strdup (comment);
@@ -1611,7 +1608,6 @@
 {
 	char       *filename;
 	GKeyFile   *desktop_entry;
-	char      **languages;
 	char       *name;
 	GtkWidget  *button;
 	char       *comment;
@@ -1626,14 +1622,13 @@
 		g_free (filename);
 		return NULL;
 	}
+	_g_key_file_cleanup (desktop_entry);
 
 	g_free (filename);
 	
-	languages = (char **) g_get_language_names ();
-	
 	icon_path = g_key_file_get_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
 	child_size = get_child_size (quick_box);
-	name = _g_key_file_get_locale_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, languages, NULL);
+	name = g_key_file_get_locale_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
 	button = quick_button_new (icon_path, child_size, name, quick_box->priv->icon_theme);
 	
 	if (button == NULL) 
@@ -1663,7 +1658,7 @@
 
 	/* tip */
 
-	comment = _g_key_file_get_locale_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, languages, NULL);
+	comment = g_key_file_get_locale_string (desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
 	tip = g_strconcat (name,
 			   ((comment != NULL) && (*comment != 0)) ? "\n" : NULL,
 			   ((comment != NULL) && (*comment != 0)) ? comment: NULL,
@@ -1935,12 +1930,11 @@
 			QuickButton *quick_button,
 			GKeyFile    *desktop_entry)
 {
-	GKeyFile  *new_desktop_entry;
-	char      *icon;
-	char     **languages;
-	char      *name;
-	char      *comment;
-	char      *tip;
+	GKeyFile *new_desktop_entry;
+	char     *icon;
+	char     *name;
+	char     *comment;
+	char     *tip;
 
 	g_return_if_fail (QUICK_IS_BOX (quick_box));
 	g_return_if_fail (QUICK_IS_BUTTON (quick_button));
@@ -1955,12 +1949,10 @@
 	icon = g_key_file_get_string (new_desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, NULL);
 	quick_button_set_pixmap (quick_button, icon, get_child_size (quick_box));
 	
-	languages = (char **) g_get_language_names ();
-	
-	name = _g_key_file_get_locale_string (new_desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, languages, NULL);
+	name = g_key_file_get_locale_string (new_desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NAME, NULL, NULL);
 	quick_button_set_text (quick_button, name);
 
-	comment = _g_key_file_get_locale_string (new_desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, languages, NULL);
+	comment = g_key_file_get_locale_string (new_desktop_entry, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_COMMENT, NULL, NULL);
 	tip = g_strconcat (name, 
 			   ((comment != NULL) && (*comment != 0)) ? "\n" : NULL, 
 			   comment, 

Modified: trunk/src/quick-lounge.c
==============================================================================
--- trunk/src/quick-lounge.c	(original)
+++ trunk/src/quick-lounge.c	Mon Feb  2 17:26:41 2009
@@ -1331,7 +1331,7 @@
 
 	panel_applet_add_preferences (applet, "/schemas/apps/quick-lounge-applet/prefs", &error);
 	if (error != NULL) {
-		g_print ("%s", error->message);
+		g_warning ("%s", error->message);
 		g_clear_error (&error);
 	}
 



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