gnome-main-menu r459 - in trunk: . libslab main-menu/src



Author: sreeves
Date: Tue May 13 20:58:33 2008
New Revision: 459
URL: http://svn.gnome.org/viewvc/gnome-main-menu?rev=459&view=rev

Log:
show an icon when thumbnail is blank - BNC#381617


Modified:
   trunk/ChangeLog
   trunk/libslab/bookmark-agent.c
   trunk/libslab/document-tile.c
   trunk/libslab/document-tile.h
   trunk/main-menu/src/main-menu-ui.c

Modified: trunk/libslab/bookmark-agent.c
==============================================================================
--- trunk/libslab/bookmark-agent.c	(original)
+++ trunk/libslab/bookmark-agent.c	Tue May 13 20:58:33 2008
@@ -1086,10 +1086,12 @@
 		dir = g_build_filename (g_get_home_dir (), "Documents", NULL);
 
 		if (! strcmp (uri, "BLANK_SPREADSHEET")) {
+			g_bookmark_file_set_title (priv->store, uri, "BLANK_SPREADSHEET");
 			file = g_strconcat (_("New Spreadsheet"), ".ots", NULL);
 			template = find_package_data_file (CALC_TEMPLATE_FILE_NAME);
 		}
 		else {
+			g_bookmark_file_set_title (priv->store, uri, "BLANK_DOCUMENT");
 			file = g_strconcat (_("New Document"), ".ott", NULL);
 			template = find_package_data_file (WRITER_TEMPLATE_FILE_NAME);
 		}

Modified: trunk/libslab/document-tile.c
==============================================================================
--- trunk/libslab/document-tile.c	(original)
+++ trunk/libslab/document-tile.c	Tue May 13 20:58:33 2008
@@ -84,6 +84,7 @@
 
 	gboolean renaming;
 	gboolean image_is_broken;
+	gchar * force_icon_name;  //show an icon instead of a thumbnail
 
 	gboolean delete_enabled;
 	guint gconf_conn_id;
@@ -108,6 +109,19 @@
 	g_type_class_add_private (this_class, sizeof (DocumentTilePrivate));
 }
 
+//Use a specific icon instead of a thumbnail.
+GtkWidget *
+document_tile_new_force_icon (const gchar *in_uri, const gchar *mime_type, time_t modified, const gchar *icon)
+{
+	DocumentTile *this;
+	DocumentTilePrivate *priv;
+	
+	this = (DocumentTile *) document_tile_new (in_uri, mime_type, modified);
+	priv = DOCUMENT_TILE_GET_PRIVATE (this);
+	priv->force_icon_name = g_strdup (icon);
+	return GTK_WIDGET (this);
+}
+
 GtkWidget *
 document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified)
 {
@@ -364,6 +378,7 @@
 
 	priv->renaming         = FALSE;
 	priv->image_is_broken  = TRUE;
+	priv->force_icon_name  = NULL;
 
 	priv->delete_enabled   = FALSE;
 	priv->gconf_conn_id    = 0;
@@ -383,6 +398,7 @@
 
 	g_free (priv->basename);
 	g_free (priv->mime_type);
+	g_free (priv->force_icon_name);
 
 	gnome_vfs_mime_application_free (priv->default_app);
 
@@ -421,8 +437,11 @@
 
 	libslab_checkpoint ("document-tile.c: load_image(): start for %s", TILE (tile)->uri);
 
-	if (! priv->mime_type || ! strstr (TILE (tile)->uri, "file://")) {
-		icon_id = "gnome-fs-regular";
+	if (priv->force_icon_name || ! priv->mime_type || ! strstr (TILE (tile)->uri, "file://")) {
+		if (priv->force_icon_name)
+			icon_id = priv->force_icon_name;
+		else
+			icon_id = "gnome-fs-regular";
 		free_icon_id = FALSE;
 
 		goto exit;

Modified: trunk/libslab/document-tile.h
==============================================================================
--- trunk/libslab/document-tile.h	(original)
+++ trunk/libslab/document-tile.h	Tue May 13 20:58:33 2008
@@ -55,6 +55,9 @@
 
 GtkWidget *document_tile_new (const gchar *uri, const gchar *mime_type, time_t modified);
 
+//If you want to show a icon instead of a thumbnail
+GtkWidget *document_tile_new_force_icon (const gchar *uri, const gchar *mime_type, time_t modified, const gchar *icon);
+
 G_END_DECLS
 
 #endif

Modified: trunk/main-menu/src/main-menu-ui.c
==============================================================================
--- trunk/main-menu/src/main-menu-ui.c	(original)
+++ trunk/main-menu/src/main-menu-ui.c	Tue May 13 20:58:33 2008
@@ -1090,6 +1090,16 @@
 static Tile *
 item_to_user_doc_tile (BookmarkItem *item, gpointer data)
 {
+	//force an icon since the thumbnail is basically blank - BNC#373783
+	if (!strcmp (item->title, "BLANK_SPREADSHEET") || !strcmp (item->title, "BLANK_DOCUMENT"))
+	{
+		if (! strcmp (item->title, "BLANK_SPREADSHEET"))
+			return TILE (document_tile_new_force_icon (item->uri, item->mime_type,
+				item->mtime, "gnome-mime-application-vnd.oasis.opendocument.spreadsheet-template"));
+		else
+			return TILE (document_tile_new_force_icon (item->uri, item->mime_type,
+				item->mtime, "gnome-mime-application-vnd.oasis.opendocument.text-template"));
+	}
 	return TILE (document_tile_new (item->uri, item->mime_type, item->mtime));
 }
 



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