` * libnautilus-extensions/nautilus-image.h: added

`	* libnautilus-extensions/nautilus-image.h:
	added nautilus_image_new_from_file convenience routine
	* libnautilus-extensions/nautilus-image.c:
	(nautilus_image_new_from_file):
	implemented nautilus_image_new_from_file to make it easy to
	convert code that used gnome_pixmap_new_from_file to use
	anti-aliased images

	* components/hardware/nautilus-hardware-view.c: (setup_form_title),
	(setup_overview_form):
	converted the hardware view to use anti-aliased images
This commit is contained in:
Andy Hertzfeld 2000-11-23 06:09:18 +00:00
parent 8586298c72
commit 94ff8a9fb1
6 changed files with 51 additions and 6 deletions

View file

@ -1,3 +1,17 @@
2000-11-22 Andy Hertzfeld <andy@eazel.com>
` * libnautilus-extensions/nautilus-image.h:
added nautilus_image_new_from_file convenience routine
* libnautilus-extensions/nautilus-image.c:
(nautilus_image_new_from_file):
implemented nautilus_image_new_from_file to make it easy to
convert code that used gnome_pixmap_new_from_file to use
anti-aliased images
* components/hardware/nautilus-hardware-view.c: (setup_form_title),
(setup_overview_form):
converted the hardware view to use anti-aliased images
2000-11-22 Michael K. Fleming <mfleming@eazel.com> 2000-11-22 Michael K. Fleming <mfleming@eazel.com>
* src/nautilus-first-time-druid.c: (set_http_proxy): * src/nautilus-first-time-druid.c: (set_http_proxy):

View file

@ -42,6 +42,7 @@
#include <libnautilus-extensions/nautilus-glib-extensions.h> #include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h> #include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-macros.h> #include <libnautilus-extensions/nautilus-gtk-macros.h>
#include <libnautilus-extensions/nautilus-image.h>
#include <libnautilus-extensions/nautilus-metadata.h> #include <libnautilus-extensions/nautilus-metadata.h>
#include <libnautilus-extensions/nautilus-string.h> #include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-label.h> #include <libnautilus-extensions/nautilus-label.h>
@ -349,7 +350,7 @@ setup_form_title (NautilusHardwareView *view, const char* image_name, const char
if (image_name != NULL) { if (image_name != NULL) {
file_name = gnome_pixmap_file (image_name); file_name = gnome_pixmap_file (image_name);
if (file_name != NULL) { if (file_name != NULL) {
temp_widget = GTK_WIDGET (gnome_pixmap_new_from_file (file_name)); temp_widget = nautilus_image_new_from_file (file_name);
gtk_box_pack_start(GTK_BOX(temp_container), temp_widget, 0, 0, 8); gtk_box_pack_start(GTK_BOX(temp_container), temp_widget, 0, 0, 8);
gtk_widget_show(temp_widget); gtk_widget_show(temp_widget);
g_free (file_name); g_free (file_name);
@ -409,10 +410,10 @@ static void setup_overview_form (NautilusHardwareView *view)
gtk_widget_show (temp_box); gtk_widget_show (temp_box);
file_name = nautilus_pixmap_file ("cpu.png"); file_name = nautilus_pixmap_file ("cpu.png");
temp_widget = GTK_WIDGET (gnome_pixmap_new_from_file (file_name)); temp_widget = nautilus_image_new_from_file (file_name);
gtk_box_pack_start(GTK_BOX(temp_box), temp_widget, 0, 0, 0); gtk_box_pack_start(GTK_BOX(temp_box), temp_widget, 0, 0, 0);
gtk_widget_show(temp_widget); gtk_widget_show(temp_widget);
g_free (file_name); g_free (file_name);
temp_widget = nautilus_label_new (temp_text); temp_widget = nautilus_label_new (temp_text);
nautilus_label_set_font_size (NAUTILUS_LABEL (temp_widget), HARDWARE_FONT_SIZE); nautilus_label_set_font_size (NAUTILUS_LABEL (temp_widget), HARDWARE_FONT_SIZE);
@ -429,7 +430,7 @@ static void setup_overview_form (NautilusHardwareView *view)
gtk_widget_show (temp_box); gtk_widget_show (temp_box);
file_name = nautilus_pixmap_file ("memory_chip.gif"); file_name = nautilus_pixmap_file ("memory_chip.gif");
temp_widget = GTK_WIDGET (gnome_pixmap_new_from_file (file_name)); temp_widget = nautilus_image_new_from_file (file_name);
gtk_box_pack_start(GTK_BOX(temp_box), temp_widget, 0, 0, 0); gtk_box_pack_start(GTK_BOX(temp_box), temp_widget, 0, 0, 0);
gtk_widget_show(temp_widget); gtk_widget_show(temp_widget);
g_free (file_name); g_free (file_name);
@ -467,7 +468,7 @@ static void setup_overview_form (NautilusHardwareView *view)
file_name = nautilus_pixmap_file("i-harddisk.png"); file_name = nautilus_pixmap_file("i-harddisk.png");
} }
pixmap_widget = GTK_WIDGET (gnome_pixmap_new_from_file(file_name)); pixmap_widget = nautilus_image_new_from_file(file_name);
gtk_box_pack_start (GTK_BOX(temp_box), pixmap_widget, 0, 0, 0); gtk_box_pack_start (GTK_BOX(temp_box), pixmap_widget, 0, 0, 0);
gtk_widget_show(pixmap_widget); gtk_widget_show(pixmap_widget);
g_free(file_name); g_free(file_name);

View file

@ -425,6 +425,20 @@ nautilus_image_new (void)
return gtk_widget_new (nautilus_image_get_type (), NULL); return gtk_widget_new (nautilus_image_get_type (), NULL);
} }
/* cover routine to allocate an image widget from the passed in image file path */
GtkWidget *
nautilus_image_new_from_file (const char* filename)
{
GtkWidget *image_widget;
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new_from_file (filename);
image_widget = nautilus_image_new ();
nautilus_image_set_pixbuf (NAUTILUS_IMAGE (image_widget), pixbuf);
gdk_pixbuf_unref (pixbuf);
return image_widget;
}
void void
nautilus_image_set_pixbuf (NautilusImage *image, GdkPixbuf *pixbuf) nautilus_image_set_pixbuf (NautilusImage *image, GdkPixbuf *pixbuf)
{ {

View file

@ -73,6 +73,7 @@ typedef enum
GtkType nautilus_image_get_type (void); GtkType nautilus_image_get_type (void);
GtkWidget * nautilus_image_new (void); GtkWidget * nautilus_image_new (void);
GtkWidget * nautilus_image_new_from_file (const char *filename);
GtkWidget * nautilus_image_new_loaded (GdkPixbuf *pixbuf, GtkWidget * nautilus_image_new_loaded (GdkPixbuf *pixbuf,
gint xpadding, gint xpadding,
gint ypadding, gint ypadding,

View file

@ -425,6 +425,20 @@ nautilus_image_new (void)
return gtk_widget_new (nautilus_image_get_type (), NULL); return gtk_widget_new (nautilus_image_get_type (), NULL);
} }
/* cover routine to allocate an image widget from the passed in image file path */
GtkWidget *
nautilus_image_new_from_file (const char* filename)
{
GtkWidget *image_widget;
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf_new_from_file (filename);
image_widget = nautilus_image_new ();
nautilus_image_set_pixbuf (NAUTILUS_IMAGE (image_widget), pixbuf);
gdk_pixbuf_unref (pixbuf);
return image_widget;
}
void void
nautilus_image_set_pixbuf (NautilusImage *image, GdkPixbuf *pixbuf) nautilus_image_set_pixbuf (NautilusImage *image, GdkPixbuf *pixbuf)
{ {

View file

@ -73,6 +73,7 @@ typedef enum
GtkType nautilus_image_get_type (void); GtkType nautilus_image_get_type (void);
GtkWidget * nautilus_image_new (void); GtkWidget * nautilus_image_new (void);
GtkWidget * nautilus_image_new_from_file (const char *filename);
GtkWidget * nautilus_image_new_loaded (GdkPixbuf *pixbuf, GtkWidget * nautilus_image_new_loaded (GdkPixbuf *pixbuf,
gint xpadding, gint xpadding,
gint ypadding, gint ypadding,