Commit 5b90ae9c authored by Gene Z. Ragan's avatar Gene Z. Ragan Committed by Gene Ragan
Browse files

Fixed bug 1633, History sidebar panel items all display generic bookmark

2000-11-13  Gene Z. Ragan  <gzr@eazel.com>

	Fixed bug 1633, History sidebar panel items all display generic
	bookmark icon.

	* libnautilus/nautilus-view-component.idl:
	Added icon string element to History structure to hold
	an pifbuf converted to a XML string.

	* src/nautilus-window-manage-views.c: (get_history_list_callback):
	Get bookmark pixbuf, convert it to XML and copt the XML string into
	the CORBA structure that is added to the list to be returned.

	* components/history/nautilus-history-view.c:
	(install_icon):
	Check and see if pixbuf is non-NULL. If it is, use it. Otherwise
	use the generic bookmark icon.

	(history_view_update_icons):
	Reload entire list to ensure that proper icons are used.

	(history_load_location):
	Call install_icon with new pixbuf parameter.
parent 0ad87e31
2000-11-13 Gene Z. Ragan <gzr@eazel.com>
Fixed bug 1633, History sidebar panel items all display generic
bookmark icon.
* libnautilus/nautilus-view-component.idl:
Added icon string element to History structure to hold
an pifbuf converted to a XML string.
* src/nautilus-window-manage-views.c: (get_history_list_callback):
Get bookmark pixbuf, convert it to XML and copt the XML string into
the CORBA structure that is added to the list to be returned.
* components/history/nautilus-history-view.c:
(install_icon):
Check and see if pixbuf is non-NULL. If it is, use it. Otherwise
use the generic bookmark icon.
(history_view_update_icons):
Reload entire list to ensure that proper icons are used.
(history_load_location):
Call install_icon with new pixbuf parameter.
2000-11-13 Eskil Heyn Olsen <eskil@eazel.com>
A lot of housecleaning, for which there were no bug reports...
......
......@@ -27,9 +27,11 @@
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-ui-util.h>
#include <gnome.h>
#include <libnautilus/libnautilus.h>
#include <libnautilus/nautilus-view-component.h>
#include <libnautilus-extensions/nautilus-gdk-pixbuf-extensions.h>
#include <libnautilus-extensions/nautilus-bookmark.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libgnome/gnome-i18n.h>
......@@ -50,6 +52,11 @@ typedef struct {
#define HISTORY_VIEW_COLUMN_NAME 1
#define HISTORY_VIEW_COLUMN_COUNT 2
static void history_load_location (NautilusView *view,
const char *location,
HistoryView *hview);
static NautilusBookmark *
get_bookmark_from_row (GtkCList *clist, int row)
{
......@@ -82,37 +89,32 @@ history_view_frame_call_end (Nautilus_HistoryFrame frame, CORBA_Environment *ev)
}
static void
install_icon (GtkCList *clist, gint row)
install_icon (GtkCList *clist, gint row, GdkPixbuf *pixbuf)
{
GdkPixmap *pixmap;
GdkBitmap *bitmap;
GdkBitmap *mask;
NautilusBookmark *bookmark;
bookmark = get_bookmark_from_row (clist, row);
if (!nautilus_bookmark_get_pixmap_and_mask (bookmark,
NAUTILUS_ICON_SIZE_SMALLER,
&pixmap,
&bitmap))
{
return;
}
gtk_clist_set_pixmap (clist,
row,
HISTORY_VIEW_COLUMN_ICON,
pixmap,
bitmap);
if (pixbuf != NULL) {
gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &mask,
NAUTILUS_STANDARD_ALPHA_THRESHHOLD);
} else {
if (!nautilus_bookmark_get_pixmap_and_mask (bookmark, NAUTILUS_ICON_SIZE_SMALLER,
&pixmap, &mask)) {
return;
}
}
gtk_clist_set_pixmap (clist, row, HISTORY_VIEW_COLUMN_ICON, pixmap, mask);
}
static void
history_view_update_icons (GtkCList *clist)
history_view_update_icons (HistoryView *hview)
{
int row;
for (row = 0; row < clist->rows; ++row) {
install_icon (clist, row);
}
/* Reload all bookmarks and pixbufs */
history_load_location (hview->view, NULL, hview);
}
static Nautilus_HistoryList *
......@@ -132,9 +134,7 @@ get_history_list (HistoryView *hview)
static void
history_load_location (NautilusView *view,
const char *location,
HistoryView *hview)
history_load_location (NautilusView *view, const char *location, HistoryView *hview)
{
char *cols[HISTORY_VIEW_COLUMN_COUNT];
int new_rownum;
......@@ -142,7 +142,9 @@ history_load_location (NautilusView *view,
NautilusBookmark *bookmark;
Nautilus_HistoryList *history_list;
Nautilus_HistoryItem *item;
GdkPixbuf *pixbuf;
guint i;
static int lock = 0;
if (lock != 0) {
......@@ -172,7 +174,14 @@ history_load_location (NautilusView *view,
gtk_clist_set_row_data_full (clist, new_rownum, bookmark,
(GtkDestroyNotify) gtk_object_unref);
install_icon (clist, new_rownum);
pixbuf = bonobo_ui_util_xml_to_pixbuf (item->icon);
if (pixbuf != NULL) {
install_icon (clist, new_rownum, pixbuf);
gdk_pixbuf_unref (pixbuf);
} else {
install_icon (clist, new_rownum, NULL);
}
gtk_clist_columns_autosize (clist);
......@@ -297,10 +306,8 @@ make_obj (BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_signal_connect(GTK_OBJECT(clist), "button-press-event", history_button_press, hview);
gtk_signal_connect(GTK_OBJECT(clist), "button-release-event", history_button_release, hview);
gtk_signal_connect_object_while_alive (nautilus_icon_factory_get (),
"icons_changed",
history_view_update_icons,
GTK_OBJECT (hview->clist));
gtk_signal_connect (nautilus_icon_factory_get (), "icons_changed",
history_view_update_icons, hview);
return BONOBO_OBJECT (hview->view);
}
......@@ -316,7 +323,7 @@ main (int argc, char *argv[])
argc, argv,
oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
bonobo_init(orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL);
gnome_vfs_init ();
registration_id = oaf_make_registration_id ("OAFIID:nautilus_history_view_factory:912d6634-d18f-40b6-bb83-bdfe16f1d15e", g_getenv ("DISPLAY"));
......
......@@ -136,6 +136,7 @@ module Nautilus {
struct HistoryItem {
string title;
URI location;
string icon;
};
typedef sequence<HistoryItem> HistoryList;
......
......@@ -35,6 +35,7 @@
#include "nautilus-zoom-control.h"
#include <gtk/gtksignal.h>
#include <gtk/gtkmain.h>
#include <bonobo/bonobo-ui-util.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomevfs/gnome-vfs-async-ops.h>
......@@ -1513,8 +1514,9 @@ get_history_list_callback (NautilusViewFrame *view,
NautilusBookmark *bookmark;
int length, i;
GList *node;
char *name, *location;
char *name, *location, *pixbuf_xml;
GdkPixbuf *pixbuf;
/* Get total number of history items */
length = g_list_length (nautilus_get_history_list ());
......@@ -1531,12 +1533,17 @@ get_history_list_callback (NautilusViewFrame *view,
name = nautilus_bookmark_get_name (bookmark);
location = nautilus_bookmark_get_uri (bookmark);
pixbuf = nautilus_bookmark_get_pixbuf (bookmark, NAUTILUS_ICON_SIZE_FOR_MENUS);
pixbuf_xml = bonobo_ui_util_pixbuf_to_xml (pixbuf);
list->_buffer[i].title = CORBA_string_dup (name);
list->_buffer[i].location = CORBA_string_dup (location);
list->_buffer[i].icon = CORBA_string_dup (pixbuf_xml);
g_free (name);
g_free (location);
g_free (pixbuf_xml);
gdk_pixbuf_unref (pixbuf);
}
return list;
......
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