New API to get and set icon data.
2000-07-14 Gene Z. Ragan <gzr@eazel.com> * libgnomevfs/gnome-vfs-mime-handlers.c: * libgnomevfs/gnome-vfs-mime-handlers.h: (gnome_vfs_mime_get_icon), (gnome_vfs_mime_set_icon): New API to get and set icon data. * mime-type-capplet/Makefile.am: Added new file mime-type-capplet/nautilus-mime-type-icon-entry.c * mime-type-capplet/nautilus-mime-type-icon-entry.c: * mime-type-capplet/nautilus-mime-type-icon-entry.h: (nautilus_mime_type_icon_entry_get_type), (nautilus_mime_type_icon_entry_class_init), (entry_changed), (entry_activated), (setup_preview), (ientry_destroy), (browse_clicked), (icon_selected_cb), (cancel_pressed), (gil_icon_selected_cb), (nautilus_mime_type_show_icon_selection), (drag_data_received), (drag_data_get), (nautilus_mime_type_icon_entry_init), (nautilus_mime_type_icon_entry_new), (nautilus_mime_type_icon_entry_gnome_file_entry), (nautilus_mime_type_icon_entry_gnome_entry), (nautilus_mime_type_icon_entry_gtk_entry), (nautilus_mime_type_icon_entry_set_pixmap_subdir), (nautilus_mime_type_icon_entry_set_icon), (nautilus_mime_type_icon_entry_get_filename): New file. This is a new verison of GnomeIconEntry. I am customizing it to look and bahve in a way that is compatible with Arlo's UI reccomendations. * mime-type-capplet/nautilus-mime-type-capplet.c: (mime_list_selected_row_callback), (icon_changed), (change_icon_clicked), (init_mime_capplet), (nautilus_mime_type_capplet_update_info), (populate_mime_list): More UI cleanups. Removed GnomeIconEntry and replaced with new NautilusMimeTypeIconEntry.
This commit is contained in:
parent
2c3cae6a9a
commit
6ebefae27f
4 changed files with 873 additions and 30 deletions
|
@ -13,7 +13,8 @@ nautilus_mime_type_capplet_SOURCES = \
|
|||
nautilus-mime-type-capplet.h \
|
||||
nautilus-mime-type-capplet-dialogs.h \
|
||||
nautilus-mime-type-capplet.c \
|
||||
nautilus-mime-type-capplet-dialogs.c
|
||||
nautilus-mime-type-capplet-dialogs.c \
|
||||
nautilus-mime-type-icon-entry.c
|
||||
|
||||
nautilus_mime_type_capplet_LDADD = \
|
||||
$(CAPPLET_LIBDIR) \
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <libgnomevfs/gnome-vfs-mime-info.h>
|
||||
|
||||
#include "nautilus-mime-type-capplet-dialogs.h"
|
||||
#include "nautilus-mime-type-icon-entry.h"
|
||||
|
||||
#include "nautilus-mime-type-capplet.h"
|
||||
|
||||
|
@ -244,10 +245,7 @@ static void
|
|||
mime_list_selected_row_callback (GtkWidget *widget, gint row, gint column, GdkEvent *event, gpointer data)
|
||||
{
|
||||
const char *mime_type;
|
||||
|
||||
if (column < 0)
|
||||
return;
|
||||
|
||||
|
||||
mime_type = (const char *) gtk_clist_get_row_data (GTK_CLIST (widget),row);
|
||||
|
||||
/* Update info on selection */
|
||||
|
@ -290,18 +288,28 @@ viewer_button_toggled (GtkToggleButton *button, gpointer user_data)
|
|||
static void
|
||||
icon_changed (GtkWidget *entry, gpointer user_data)
|
||||
{
|
||||
gchar *filename;
|
||||
gchar *path, *filename;
|
||||
const char *mime_type;
|
||||
|
||||
filename = gnome_icon_entry_get_filename (GNOME_ICON_ENTRY (icon_entry));
|
||||
|
||||
if (filename != NULL) {
|
||||
g_message ("%s", filename);
|
||||
} else {
|
||||
g_message ("No filename");
|
||||
g_free (filename);
|
||||
path = nautilus_mime_type_icon_entry_get_filename (NAUTILUS_MIME_ICON_ENTRY (icon_entry));
|
||||
if (path != NULL) {
|
||||
g_message ("%s", path);
|
||||
filename = strrchr (path, '/');
|
||||
if (filename != NULL) {
|
||||
filename++;
|
||||
mime_type = nautilus_mime_type_capplet_get_selected_item_mime_type ();
|
||||
gnome_vfs_mime_set_icon (mime_type, filename);
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
change_icon_clicked (GtkWidget *entry, gpointer user_data)
|
||||
{
|
||||
nautilus_mime_type_show_icon_selection (NAUTILUS_MIME_ICON_ENTRY (user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
init_mime_capplet (void)
|
||||
{
|
||||
|
@ -313,7 +321,7 @@ init_mime_capplet (void)
|
|||
GtkWidget *frame;
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *table, *extensions_table;
|
||||
GList *children;
|
||||
//GList *children;
|
||||
int index, list_width, column_width;
|
||||
|
||||
capplet = capplet_widget_new ();
|
||||
|
@ -345,27 +353,26 @@ init_mime_capplet (void)
|
|||
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
||||
|
||||
icon_entry = gnome_icon_entry_new ("mime_icon_entry", NULL);
|
||||
children = gtk_container_children (GTK_CONTAINER (GNOME_ICON_ENTRY (icon_entry)->pickbutton));
|
||||
icon_entry_label = GTK_LABEL (children->data);
|
||||
gtk_label_set_text (icon_entry_label, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (gnome_icon_entry_gtk_entry (GNOME_ICON_ENTRY (icon_entry))),
|
||||
icon_entry = nautilus_mime_type_icon_entry_new ("mime_icon_entry", NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (nautilus_mime_type_icon_entry_gtk_entry (NAUTILUS_MIME_ICON_ENTRY (icon_entry))),
|
||||
"changed", icon_changed, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), icon_entry, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_button_new_with_label (_("Change Icon"));
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked", icon_changed, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked", change_icon_clicked, icon_entry);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
|
||||
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
||||
|
||||
description_entry = gtk_entry_new ();
|
||||
alignment = gtk_alignment_new (0, 0, 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), description_entry);
|
||||
gtk_widget_set_usize (description_entry, 200, 0);
|
||||
|
||||
mime_label = gtk_label_new (_("Mime Type"));
|
||||
mime_label = gtk_label_new (_("Mime Type"));
|
||||
gtk_label_set_justify (GTK_LABEL (mime_label), GTK_JUSTIFY_RIGHT);
|
||||
alignment = gtk_alignment_new (0, 0, 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), mime_label);
|
||||
|
@ -536,12 +543,11 @@ nautilus_mime_type_capplet_update_info (const char *mime_type) {
|
|||
populate_extension_list (mime_type, GTK_CLIST (extension_list));
|
||||
|
||||
/* Set icon for mime type */
|
||||
icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
|
||||
icon_name = gnome_vfs_mime_get_icon (mime_type);
|
||||
path = pixmap_file (icon_name);
|
||||
gnome_icon_entry_set_icon (GNOME_ICON_ENTRY (icon_entry), path);
|
||||
nautilus_mime_type_icon_entry_set_icon (NAUTILUS_MIME_ICON_ENTRY (icon_entry), path);
|
||||
if (path != NULL) {
|
||||
g_free (path);
|
||||
g_message ("%s", gnome_icon_entry_get_filename (GNOME_ICON_ENTRY (icon_entry)));
|
||||
} else {
|
||||
gtk_label_set_text (icon_entry_label, NULL);
|
||||
}
|
||||
|
@ -947,8 +953,8 @@ static void
|
|||
populate_mime_list (GList *type_list, GtkCList *clist)
|
||||
{
|
||||
static gchar *text[3];
|
||||
const char *description;
|
||||
char *extensions, *mime_string;
|
||||
const char *description, *action_icon_name;
|
||||
char *extensions, *mime_string, *action_icon_path;
|
||||
gint row;
|
||||
GList *element;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
@ -991,7 +997,7 @@ populate_mime_list (GList *type_list, GtkCList *clist)
|
|||
gtk_clist_set_row_data (GTK_CLIST (clist), row, g_strdup(mime_string));
|
||||
|
||||
/* Set column icons */
|
||||
pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/eazel/i-regular-12.png");
|
||||
pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/i-regular-12.png");
|
||||
if (pixbuf != NULL) {
|
||||
gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &bitmap, 100);
|
||||
gtk_clist_set_pixtext (clist, row, 0, text[0], 5, pixmap, bitmap);
|
||||
|
@ -1019,8 +1025,19 @@ populate_mime_list (GList *type_list, GtkCList *clist)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/eazel/i-regular-12.png");
|
||||
|
||||
|
||||
action_icon_name = gnome_vfs_mime_get_icon (mime_string);
|
||||
if (action_icon_name != NULL) {
|
||||
/* Get custom icon */
|
||||
action_icon_path = pixmap_file (action_icon_name);
|
||||
pixbuf = gdk_pixbuf_new_from_file (action_icon_path);
|
||||
} else {
|
||||
/* Use default icon */
|
||||
pixbuf = gdk_pixbuf_new_from_file ("/gnome/share/pixmaps/nautilus/i-regular-12.png");
|
||||
}
|
||||
|
||||
/* Set column icon */
|
||||
if (pixbuf != NULL) {
|
||||
gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &bitmap, 100);
|
||||
gtk_clist_set_pixtext (clist, row, 3, text[3], 5, pixmap, bitmap);
|
||||
|
|
754
capplets/file-types/file-types-icon-entry.c
Normal file
754
capplets/file-types/file-types-icon-entry.c
Normal file
|
@ -0,0 +1,754 @@
|
|||
/* NautilusMimeIconEntry widget - Combo box with "Browse" button for files and
|
||||
* A pick button which can display a list of icons
|
||||
* in a current directory, the browse button displays
|
||||
* same dialog as pixmap-entry
|
||||
*
|
||||
* Copyright (C) 1998 The Free Software Foundation
|
||||
*
|
||||
* Author: George Lebl <jirka@5z.com>
|
||||
* icon selection based on original dentry-edit code which was:
|
||||
* Written by: Havoc Pennington, based on code by John Ellis.
|
||||
*/
|
||||
#include <config.h>
|
||||
|
||||
#include "nautilus-mime-type-icon-entry.h"
|
||||
|
||||
#include <gdk_imlib.h>
|
||||
#include <gnome.h>
|
||||
#include <gtk/gtkbutton.h>
|
||||
#include <gtk/gtkdnd.h>
|
||||
#include <gtk/gtkentry.h>
|
||||
#include <gtk/gtkfilesel.h>
|
||||
#include <gtk/gtkframe.h>
|
||||
#include <gtk/gtklabel.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <gtk/gtkpixmap.h>
|
||||
#include <gtk/gtkscrolledwindow.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
|
||||
static void nautilus_mime_type_icon_entry_class_init (GnomeIconEntryClass *class);
|
||||
static void nautilus_mime_type_icon_entry_init (NautilusMimeIconEntry *ientry);
|
||||
static void drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint time,
|
||||
NautilusMimeIconEntry *ientry);
|
||||
static void drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint32 time,
|
||||
NautilusMimeIconEntry *ientry);
|
||||
|
||||
static GtkVBoxClass *parent_class;
|
||||
|
||||
static GtkTargetEntry drop_types[] = { { "text/uri-list", 0, 0 } };
|
||||
|
||||
guint
|
||||
nautilus_mime_type_icon_entry_get_type (void)
|
||||
{
|
||||
static guint icon_entry_type = 0;
|
||||
|
||||
if (!icon_entry_type) {
|
||||
GtkTypeInfo icon_entry_info = {
|
||||
"NautilusMimeIconEntry",
|
||||
sizeof (NautilusMimeIconEntry),
|
||||
sizeof (GnomeIconEntryClass),
|
||||
(GtkClassInitFunc) nautilus_mime_type_icon_entry_class_init,
|
||||
(GtkObjectInitFunc) nautilus_mime_type_icon_entry_init,
|
||||
(GtkArgSetFunc) NULL,
|
||||
(GtkArgGetFunc) NULL
|
||||
};
|
||||
|
||||
icon_entry_type = gtk_type_unique (gtk_vbox_get_type (),
|
||||
&icon_entry_info);
|
||||
}
|
||||
|
||||
return icon_entry_type;
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_mime_type_icon_entry_class_init (GnomeIconEntryClass *class)
|
||||
{
|
||||
parent_class = gtk_type_class (gtk_hbox_get_type ());
|
||||
}
|
||||
|
||||
static void
|
||||
entry_changed(GtkWidget *widget, NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
gchar *t;
|
||||
GdkImlibImage *im;
|
||||
GtkWidget *child;
|
||||
int w,h;
|
||||
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
t = gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(ientry->fentry),
|
||||
FALSE);
|
||||
|
||||
child = GTK_BIN(ientry->frame)->child;
|
||||
|
||||
if(!t || !g_file_test (t,G_FILE_TEST_ISLINK|G_FILE_TEST_ISFILE) ||
|
||||
!(im = gdk_imlib_load_image (t))) {
|
||||
if (GNOME_IS_PIXMAP(child)) {
|
||||
gtk_drag_source_unset (ientry->frame);
|
||||
gtk_widget_destroy(child);
|
||||
}
|
||||
g_free(t);
|
||||
return;
|
||||
}
|
||||
g_free(t);
|
||||
w = im->rgb_width;
|
||||
h = im->rgb_height;
|
||||
if(w>h) {
|
||||
if(w>48) {
|
||||
h = h*(48.0/w);
|
||||
w = 48;
|
||||
}
|
||||
} else {
|
||||
if(h>48) {
|
||||
w = w*(48.0/h);
|
||||
h = 48;
|
||||
}
|
||||
}
|
||||
if(GNOME_IS_PIXMAP (child)) {
|
||||
gnome_pixmap_load_imlib_at_size (GNOME_PIXMAP(child),im, w, h);
|
||||
} else {
|
||||
gtk_widget_destroy(child);
|
||||
child = gnome_pixmap_new_from_imlib_at_size (im, w, h);
|
||||
gtk_widget_show(child);
|
||||
gtk_container_add (GTK_CONTAINER(ientry->frame), child);
|
||||
|
||||
if(!GTK_WIDGET_NO_WINDOW(child)) {
|
||||
gtk_signal_connect (GTK_OBJECT (child), "drag_data_get",
|
||||
GTK_SIGNAL_FUNC (drag_data_get),ientry);
|
||||
gtk_drag_source_set (child,
|
||||
GDK_BUTTON1_MASK|GDK_BUTTON3_MASK,
|
||||
drop_types, 1,
|
||||
GDK_ACTION_COPY);
|
||||
}
|
||||
}
|
||||
gdk_imlib_destroy_image(im);
|
||||
gtk_drag_source_set (ientry->frame,
|
||||
GDK_BUTTON1_MASK|GDK_BUTTON3_MASK,
|
||||
drop_types, 1,
|
||||
GDK_ACTION_COPY);
|
||||
}
|
||||
|
||||
static void
|
||||
entry_activated(GtkWidget *widget, NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
struct stat buf;
|
||||
GnomeIconSelection * gis;
|
||||
gchar *filename;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_ENTRY (widget));
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
filename = gtk_entry_get_text (GTK_ENTRY (widget));
|
||||
|
||||
if (!filename)
|
||||
return;
|
||||
|
||||
stat (filename, &buf);
|
||||
if (S_ISDIR (buf.st_mode)) {
|
||||
gis = gtk_object_get_user_data(GTK_OBJECT(ientry));
|
||||
gnome_icon_selection_clear (gis, TRUE);
|
||||
gnome_icon_selection_add_directory (gis, filename);
|
||||
if (gis->file_list)
|
||||
gnome_icon_selection_show_icons(gis);
|
||||
} else {
|
||||
/* We pretend like ok has been called */
|
||||
entry_changed (NULL, ientry);
|
||||
gtk_widget_hide (ientry->pick_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
setup_preview(GtkWidget *widget)
|
||||
{
|
||||
gchar *p;
|
||||
GList *l;
|
||||
GtkWidget *pp = NULL;
|
||||
GdkImlibImage *im;
|
||||
int w,h;
|
||||
GtkWidget *frame;
|
||||
GtkFileSelection *fs;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
frame = gtk_object_get_data(GTK_OBJECT(widget),"frame");
|
||||
fs = gtk_object_get_data(GTK_OBJECT(frame),"fs");
|
||||
|
||||
if((l = gtk_container_children(GTK_CONTAINER(frame))) != NULL) {
|
||||
pp = l->data;
|
||||
g_list_free(l);
|
||||
}
|
||||
|
||||
if(pp)
|
||||
gtk_widget_destroy(pp);
|
||||
|
||||
p = gtk_file_selection_get_filename(fs);
|
||||
if(!p || !g_file_test (p,G_FILE_TEST_ISLINK|G_FILE_TEST_ISFILE) ||
|
||||
!(im = gdk_imlib_load_image (p)))
|
||||
return;
|
||||
|
||||
w = im->rgb_width;
|
||||
h = im->rgb_height;
|
||||
if(w>h) {
|
||||
if(w>100) {
|
||||
h = h*(100.0/w);
|
||||
w = 100;
|
||||
}
|
||||
} else {
|
||||
if(h>100) {
|
||||
w = w*(100.0/h);
|
||||
h = 100;
|
||||
}
|
||||
}
|
||||
pp = gnome_pixmap_new_from_imlib_at_size (im, w, h);
|
||||
gtk_widget_show(pp);
|
||||
gtk_container_add(GTK_CONTAINER(frame),pp);
|
||||
|
||||
gdk_imlib_destroy_image(im);
|
||||
}
|
||||
|
||||
static void
|
||||
ientry_destroy(NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
if(ientry->fentry)
|
||||
gtk_widget_unref (ientry->fentry);
|
||||
if(ientry->pick_dialog)
|
||||
gtk_widget_destroy(ientry->pick_dialog);
|
||||
if(ientry->pick_dialog_dir)
|
||||
g_free(ientry->pick_dialog_dir);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
browse_clicked(GnomeFileEntry *fentry, NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
GtkWidget *w;
|
||||
GtkWidget *hbox;
|
||||
|
||||
GtkFileSelection *fs;
|
||||
|
||||
g_return_if_fail (fentry != NULL);
|
||||
g_return_if_fail (GNOME_IS_FILE_ENTRY (fentry));
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
if(!fentry->fsw)
|
||||
return;
|
||||
fs = GTK_FILE_SELECTION(fentry->fsw);
|
||||
|
||||
hbox = fs->file_list;
|
||||
do {
|
||||
hbox = hbox->parent;
|
||||
if(!hbox) {
|
||||
g_warning(_("Can't find an hbox, using a normal file "
|
||||
"selection"));
|
||||
return;
|
||||
}
|
||||
} while(!GTK_IS_HBOX(hbox));
|
||||
|
||||
w = gtk_frame_new(_("Preview"));
|
||||
gtk_widget_show(w);
|
||||
gtk_box_pack_end(GTK_BOX(hbox),w,FALSE,FALSE,0);
|
||||
gtk_widget_set_usize(w,110,110);
|
||||
gtk_object_set_data(GTK_OBJECT(w),"fs",fs);
|
||||
|
||||
gtk_object_set_data(GTK_OBJECT(fs->file_list),"frame",w);
|
||||
gtk_signal_connect(GTK_OBJECT(fs->file_list),"select_row",
|
||||
GTK_SIGNAL_FUNC(setup_preview),NULL);
|
||||
gtk_object_set_data(GTK_OBJECT(fs->selection_entry),"frame",w);
|
||||
gtk_signal_connect_while_alive(GTK_OBJECT(fs->selection_entry),
|
||||
"changed",
|
||||
GTK_SIGNAL_FUNC(setup_preview),NULL,
|
||||
GTK_OBJECT(fs));
|
||||
}
|
||||
|
||||
static void
|
||||
icon_selected_cb (GtkButton * button, NautilusMimeIconEntry * ientry)
|
||||
{
|
||||
const gchar * icon;
|
||||
GnomeIconSelection * gis;
|
||||
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
gis = gtk_object_get_user_data(GTK_OBJECT(ientry));
|
||||
gnome_icon_selection_stop_loading(gis);
|
||||
icon = gnome_icon_selection_get_icon(gis, TRUE);
|
||||
|
||||
if (icon != NULL) {
|
||||
GtkWidget *e = nautilus_mime_type_icon_entry_gtk_entry (ientry);
|
||||
gtk_entry_set_text(GTK_ENTRY(e),icon);
|
||||
entry_changed (NULL, ientry);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_pressed (GtkButton * button, NautilusMimeIconEntry * ientry)
|
||||
{
|
||||
GnomeIconSelection * gis;
|
||||
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
gis = gtk_object_get_user_data(GTK_OBJECT(ientry));
|
||||
gnome_icon_selection_stop_loading(gis);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gil_icon_selected_cb (GnomeIconList *gil, gint num, GdkEvent *event, NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
const gchar * icon;
|
||||
GnomeIconSelection * gis;
|
||||
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
gis = gtk_object_get_user_data(GTK_OBJECT(ientry));
|
||||
icon = gnome_icon_selection_get_icon(gis, TRUE);
|
||||
|
||||
if (icon != NULL) {
|
||||
GtkWidget *e = nautilus_mime_type_icon_entry_gtk_entry(ientry);
|
||||
gtk_entry_set_text(GTK_ENTRY(e),icon);
|
||||
|
||||
}
|
||||
|
||||
if(event && event->type == GDK_2BUTTON_PRESS && ((GdkEventButton *)event)->button == 1) {
|
||||
gnome_icon_selection_stop_loading(gis);
|
||||
entry_changed (NULL, ientry);
|
||||
gtk_widget_hide(ientry->pick_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_mime_type_show_icon_selection (NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
GnomeFileEntry *fe;
|
||||
gchar *p;
|
||||
gchar *curfile;
|
||||
GtkWidget *tl;
|
||||
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
fe = GNOME_FILE_ENTRY (ientry->fentry);
|
||||
p = gnome_file_entry_get_full_path (fe, FALSE);
|
||||
curfile = nautilus_mime_type_icon_entry_get_filename (ientry);
|
||||
|
||||
/* Are we part of a modal window? If so, we need to be modal too. */
|
||||
tl = gtk_widget_get_toplevel (GTK_WIDGET (ientry->frame));
|
||||
|
||||
if(!p) {
|
||||
if(fe->default_path)
|
||||
p = g_strdup(fe->default_path);
|
||||
else {
|
||||
/*get around the g_free/free issue*/
|
||||
gchar *cwd = g_get_current_dir ();
|
||||
p = g_strdup(cwd);
|
||||
g_free(cwd);
|
||||
}
|
||||
gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (ientry->fentry))),
|
||||
p);
|
||||
}
|
||||
|
||||
/*figure out the directory*/
|
||||
if(!g_file_test (p,G_FILE_TEST_ISDIR)) {
|
||||
gchar *d;
|
||||
d = g_dirname (p);
|
||||
g_free (p);
|
||||
p = d;
|
||||
if(!g_file_test (p,G_FILE_TEST_ISDIR)) {
|
||||
g_free (p);
|
||||
if(fe->default_path)
|
||||
p = g_strdup(fe->default_path);
|
||||
else {
|
||||
/*get around the g_free/free issue*/
|
||||
gchar *cwd = g_get_current_dir ();
|
||||
p = g_strdup(cwd);
|
||||
free(cwd);
|
||||
}
|
||||
gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (ientry->fentry))),
|
||||
p);
|
||||
g_return_if_fail(g_file_test (p,G_FILE_TEST_ISDIR));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(ientry->pick_dialog==NULL ||
|
||||
ientry->pick_dialog_dir==NULL ||
|
||||
strcmp(p,ientry->pick_dialog_dir)!=0) {
|
||||
GtkWidget * iconsel;
|
||||
|
||||
if(ientry->pick_dialog) {
|
||||
gtk_container_remove (GTK_CONTAINER (ientry->fentry->parent), ientry->fentry);
|
||||
gtk_widget_destroy(ientry->pick_dialog);
|
||||
}
|
||||
|
||||
if(ientry->pick_dialog_dir)
|
||||
g_free(ientry->pick_dialog_dir);
|
||||
ientry->pick_dialog_dir = p;
|
||||
ientry->pick_dialog =
|
||||
gnome_dialog_new(GNOME_FILE_ENTRY(ientry->fentry)->browse_dialog_title,
|
||||
GNOME_STOCK_BUTTON_OK,
|
||||
GNOME_STOCK_BUTTON_CANCEL,
|
||||
NULL);
|
||||
if (GTK_WINDOW (tl)->modal) {
|
||||
gtk_window_set_modal (GTK_WINDOW (ientry->pick_dialog), TRUE);
|
||||
gnome_dialog_set_parent (GNOME_DIALOG (ientry->pick_dialog), GTK_WINDOW (tl));
|
||||
}
|
||||
gnome_dialog_close_hides(GNOME_DIALOG(ientry->pick_dialog), TRUE);
|
||||
gnome_dialog_set_close (GNOME_DIALOG(ientry->pick_dialog), TRUE);
|
||||
|
||||
gtk_window_set_policy(GTK_WINDOW(ientry->pick_dialog),
|
||||
TRUE, TRUE, TRUE);
|
||||
|
||||
iconsel = gnome_icon_selection_new();
|
||||
|
||||
gtk_object_set_user_data(GTK_OBJECT(ientry), iconsel);
|
||||
|
||||
gnome_icon_selection_add_directory(GNOME_ICON_SELECTION(iconsel),
|
||||
ientry->pick_dialog_dir);
|
||||
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(ientry->pick_dialog)->vbox),
|
||||
ientry->fentry, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(ientry->pick_dialog)->vbox),
|
||||
iconsel, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show_all(ientry->pick_dialog);
|
||||
|
||||
gnome_icon_selection_show_icons(GNOME_ICON_SELECTION(iconsel));
|
||||
|
||||
if(curfile)
|
||||
gnome_icon_selection_select_icon(GNOME_ICON_SELECTION(iconsel),
|
||||
g_filename_pointer(curfile));
|
||||
|
||||
gnome_dialog_button_connect(GNOME_DIALOG(ientry->pick_dialog),
|
||||
0, /* OK button */
|
||||
GTK_SIGNAL_FUNC(icon_selected_cb),
|
||||
ientry);
|
||||
gnome_dialog_button_connect(GNOME_DIALOG(ientry->pick_dialog),
|
||||
1, /* Cancel button */
|
||||
GTK_SIGNAL_FUNC(cancel_pressed),
|
||||
ientry);
|
||||
gtk_signal_connect_after(GTK_OBJECT(GNOME_ICON_SELECTION(iconsel)->gil), "select_icon",
|
||||
GTK_SIGNAL_FUNC(gil_icon_selected_cb),
|
||||
ientry);
|
||||
} else {
|
||||
GnomeIconSelection *gis =
|
||||
gtk_object_get_user_data(GTK_OBJECT(ientry));
|
||||
if(!GTK_WIDGET_VISIBLE(ientry->pick_dialog))
|
||||
gtk_widget_show(ientry->pick_dialog);
|
||||
if(gis) {
|
||||
gnome_icon_selection_show_icons(gis);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
gint y,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint32 time,
|
||||
NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
GList *files;
|
||||
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
/*here we extract the filenames from the URI-list we recieved*/
|
||||
files = gnome_uri_list_extract_filenames(selection_data->data);
|
||||
/*if there's isn't a file*/
|
||||
if(!files) {
|
||||
gtk_drag_finish(context,FALSE,FALSE,time);
|
||||
return;
|
||||
}
|
||||
|
||||
nautilus_mime_type_icon_entry_set_icon (ientry, files->data);
|
||||
|
||||
/*free the list of files we got*/
|
||||
gnome_uri_list_free_strings (files);
|
||||
}
|
||||
|
||||
static void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint time,
|
||||
NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
gchar *string;
|
||||
gchar *file;
|
||||
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
file = gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(ientry->fentry),
|
||||
TRUE);
|
||||
|
||||
if(!file) {
|
||||
/*FIXME: cancel the drag*/
|
||||
return;
|
||||
}
|
||||
|
||||
string = g_strdup_printf("file:%s\r\n",file);
|
||||
g_free(file);
|
||||
gtk_selection_data_set (selection_data,
|
||||
selection_data->target,
|
||||
8, string, strlen(string)+1);
|
||||
g_free(string);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
nautilus_mime_type_icon_entry_init (NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
GtkWidget *w;
|
||||
gchar *p;
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (ientry), 4);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(ientry),"destroy",
|
||||
GTK_SIGNAL_FUNC(ientry_destroy), NULL);
|
||||
|
||||
ientry->pick_dialog = NULL;
|
||||
ientry->pick_dialog_dir = NULL;
|
||||
|
||||
w = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_widget_show(w);
|
||||
gtk_box_pack_start (GTK_BOX (ientry), w, TRUE, TRUE, 0);
|
||||
ientry->frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (ientry->frame), GTK_SHADOW_IN);
|
||||
gtk_drag_dest_set (GTK_WIDGET (ientry->frame),
|
||||
GTK_DEST_DEFAULT_MOTION |
|
||||
GTK_DEST_DEFAULT_HIGHLIGHT |
|
||||
GTK_DEST_DEFAULT_DROP,
|
||||
drop_types, 1, GDK_ACTION_COPY);
|
||||
gtk_signal_connect (GTK_OBJECT (ientry->frame),
|
||||
"drag_data_received",
|
||||
GTK_SIGNAL_FUNC (drag_data_received),ientry);
|
||||
gtk_signal_connect (GTK_OBJECT (ientry->frame), "drag_data_get",
|
||||
GTK_SIGNAL_FUNC (drag_data_get),ientry);
|
||||
|
||||
/*60x60 is just larger then default 48x48, though icon sizes
|
||||
are supposed to be selectable I guess*/
|
||||
gtk_widget_set_usize (ientry->frame,60,60);
|
||||
gtk_container_add (GTK_CONTAINER (w), ientry->frame);
|
||||
gtk_widget_show (ientry->frame);
|
||||
|
||||
ientry->fentry = gnome_file_entry_new (NULL,NULL);
|
||||
gnome_file_entry_set_modal (GNOME_FILE_ENTRY (ientry->fentry), TRUE);
|
||||
gtk_widget_ref (ientry->fentry);
|
||||
gtk_signal_connect_after(GTK_OBJECT(ientry->fentry),"browse_clicked",
|
||||
GTK_SIGNAL_FUNC(browse_clicked),
|
||||
ientry);
|
||||
|
||||
gtk_widget_show (ientry->fentry);
|
||||
|
||||
p = gnome_pixmap_file (".");
|
||||
gnome_file_entry_set_default_path (GNOME_FILE_ENTRY(ientry->fentry),p);
|
||||
g_free (p);
|
||||
|
||||
w = gnome_file_entry_gtk_entry(GNOME_FILE_ENTRY(ientry->fentry));
|
||||
/* gtk_signal_connect_while_alive(GTK_OBJECT(w), "changed",
|
||||
GTK_SIGNAL_FUNC(entry_changed),
|
||||
ientry, GTK_OBJECT(ientry));*/
|
||||
gtk_signal_connect_while_alive(GTK_OBJECT(w), "activate",
|
||||
GTK_SIGNAL_FUNC(entry_activated),
|
||||
ientry, GTK_OBJECT(ientry));
|
||||
|
||||
|
||||
/*just in case there is a default that is an image*/
|
||||
entry_changed(w,ientry);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_mime_type_icon_entry_new:
|
||||
* @history_id: the id given to #gnome_entry_new
|
||||
* @browse_dialog_title: title of the browse dialog and icon selection dialog
|
||||
*
|
||||
* Description: Creates a new icon entry widget
|
||||
*
|
||||
* Returns: Returns the new object
|
||||
**/
|
||||
GtkWidget *
|
||||
nautilus_mime_type_icon_entry_new (const gchar *history_id, const gchar *browse_dialog_title)
|
||||
{
|
||||
NautilusMimeIconEntry *ientry;
|
||||
GtkWidget *gentry;
|
||||
|
||||
ientry = gtk_type_new (nautilus_mime_type_icon_entry_get_type ());
|
||||
|
||||
/* Keep in sync with gnome_entry_new() - or better yet,
|
||||
add a _construct() method once we are in development
|
||||
branch.
|
||||
*/
|
||||
|
||||
gentry = gnome_file_entry_gnome_entry(GNOME_FILE_ENTRY(ientry->fentry));
|
||||
|
||||
gnome_entry_set_history_id (GNOME_ENTRY (gentry), history_id);
|
||||
gnome_entry_load_history (GNOME_ENTRY (gentry));
|
||||
gnome_file_entry_set_title (GNOME_FILE_ENTRY(ientry->fentry),
|
||||
browse_dialog_title);
|
||||
|
||||
return GTK_WIDGET (ientry);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_mime_type_icon_entry_gnome_file_entry:
|
||||
* @ientry: the NautilusMimeIconEntry to work with
|
||||
*
|
||||
* Description: Get the GnomeFileEntry widget that's part of the entry
|
||||
*
|
||||
* Returns: Returns GnomeFileEntry widget
|
||||
**/
|
||||
GtkWidget *
|
||||
nautilus_mime_type_icon_entry_gnome_file_entry (NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
g_return_val_if_fail (ientry != NULL, NULL);
|
||||
g_return_val_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry), NULL);
|
||||
|
||||
return ientry->fentry;
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_mime_type_icon_entry_gnome_entry:
|
||||
* @ientry: the NautilusMimeIconEntry to work with
|
||||
*
|
||||
* Description: Get the GnomeEntry widget that's part of the entry
|
||||
*
|
||||
* Returns: Returns GnomeEntry widget
|
||||
**/
|
||||
GtkWidget *
|
||||
nautilus_mime_type_icon_entry_gnome_entry (NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
g_return_val_if_fail (ientry != NULL, NULL);
|
||||
g_return_val_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry), NULL);
|
||||
|
||||
return gnome_file_entry_gnome_entry(GNOME_FILE_ENTRY(ientry->fentry));
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_mime_type_icon_entry_gtk_entry:
|
||||
* @ientry: the NautilusMimeIconEntry to work with
|
||||
*
|
||||
* Description: Get the GtkEntry widget that's part of the entry
|
||||
*
|
||||
* Returns: Returns GtkEntry widget
|
||||
**/
|
||||
GtkWidget *
|
||||
nautilus_mime_type_icon_entry_gtk_entry (NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
g_return_val_if_fail (ientry != NULL, NULL);
|
||||
g_return_val_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry), NULL);
|
||||
|
||||
return gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (ientry->fentry));
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_mime_type_icon_entry_set_pixmap_subdir:
|
||||
* @ientry: the NautilusMimeIconEntry to work with
|
||||
* @subdir: subdirectory
|
||||
*
|
||||
* Description: Sets the subdirectory below gnome's default
|
||||
* pixmap directory to use as the default path for the file
|
||||
* entry.
|
||||
*
|
||||
* Returns:
|
||||
**/
|
||||
void
|
||||
nautilus_mime_type_icon_entry_set_pixmap_subdir(NautilusMimeIconEntry *ientry,
|
||||
const gchar *subdir)
|
||||
{
|
||||
gchar *p;
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
if(!subdir)
|
||||
subdir = ".";
|
||||
|
||||
p = gnome_pixmap_file(subdir);
|
||||
gnome_file_entry_set_default_path(GNOME_FILE_ENTRY(ientry->fentry),p);
|
||||
g_free(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_mime_type_icon_entry_set_icon:
|
||||
* @ientry: the NautilusMimeIconEntry to work with
|
||||
* @filename: a filename
|
||||
*
|
||||
* Description: Sets the icon of NautilusMimeIconEntry to be the one pointed to by
|
||||
* @filename (in the current subdirectory).
|
||||
*
|
||||
* Returns:
|
||||
**/
|
||||
void
|
||||
nautilus_mime_type_icon_entry_set_icon (NautilusMimeIconEntry *ientry, const gchar *filename)
|
||||
{
|
||||
g_return_if_fail (ientry != NULL);
|
||||
g_return_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry));
|
||||
|
||||
if(!filename) {
|
||||
filename = "";
|
||||
}
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (nautilus_mime_type_icon_entry_gtk_entry (ientry)), filename);
|
||||
entry_changed (NULL, ientry);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_mime_type_icon_entry_get_filename:
|
||||
* @ientry: the NautilusMimeIconEntry to work with
|
||||
*
|
||||
* Description: Gets the file name of the image if it was possible
|
||||
* to load it into the preview. That is, it will only return a filename
|
||||
* if the image exists and it was possible to load it as an image.
|
||||
*
|
||||
* Returns: a newly allocated string with the path or %NULL if it
|
||||
* couldn't load the file
|
||||
**/
|
||||
gchar *
|
||||
nautilus_mime_type_icon_entry_get_filename (NautilusMimeIconEntry *ientry)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_val_if_fail (ientry != NULL,NULL);
|
||||
g_return_val_if_fail (NAUTILUS_MIME_IS_ICON_ENTRY (ientry),NULL);
|
||||
|
||||
child = GTK_BIN(ientry->frame)->child;
|
||||
|
||||
/* this happens if it doesn't exist or isn't an image */
|
||||
if (!GNOME_IS_PIXMAP (child)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return gnome_file_entry_get_full_path(GNOME_FILE_ENTRY(ientry->fentry),
|
||||
TRUE);
|
||||
}
|
71
capplets/file-types/file-types-icon-entry.h
Normal file
71
capplets/file-types/file-types-icon-entry.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
/* NautilusMimeIconEntry widget - Combo box with "Browse" button for files and
|
||||
* A pick button which can display a list of icons
|
||||
* in a current directory, the browse button displays
|
||||
* same dialog as pixmap-entry
|
||||
*
|
||||
* Copyright (C) 1998 The Free Software Foundation
|
||||
*
|
||||
* Author: George Lebl <jirka@5z.com>
|
||||
* icon selection based on original dentry-edit code which was:
|
||||
* Written by: Havoc Pennington, based on code by John Ellis.
|
||||
*/
|
||||
|
||||
#ifndef NAUTILUS_MIME_TYPE_ICON_ENTRY_H
|
||||
#define NAUTILUS_MIME_TYPE_ICON_ENTRY_H
|
||||
|
||||
#include <gtk/gtkframe.h>
|
||||
#include <gtk/gtkvbox.h>
|
||||
#include <libgnome/gnome-defs.h>
|
||||
#include <libgnomeui/gnome-file-entry.h>
|
||||
|
||||
|
||||
BEGIN_GNOME_DECLS
|
||||
|
||||
|
||||
#define NAUTILUS_TYPE_MIME_ICON_ENTRY (nautilus_mime_type_icon_entry_get_type ())
|
||||
#define NAUTILUS_MIME_ICON_ENTRY(obj) (GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_MIME_ICON_ENTRY, NautilusMimeIconEntry))
|
||||
#define NAUTILUS_MIME_ICON_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_MIME_ICON_ENTRY, NautilusMimeIconEntryClass))
|
||||
#define NAUTILUS_MIME_IS_ICON_ENTRY(obj) (GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_MIME_ICON_ENTRY))
|
||||
#define NAUTILUS_MIME_IS_ICON_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_MIME_ICON_ENTRY))
|
||||
|
||||
|
||||
typedef struct _NautilusMimeIconEntry NautilusMimeIconEntry;
|
||||
typedef struct _NautilusMimeIconEntryClass NautilusMimeIconEntryClass;
|
||||
|
||||
struct _NautilusMimeIconEntry {
|
||||
GtkVBox vbox;
|
||||
|
||||
GtkWidget *fentry;
|
||||
GtkWidget *frame;
|
||||
|
||||
GtkWidget *pick_dialog;
|
||||
gchar *pick_dialog_dir;
|
||||
};
|
||||
|
||||
struct _NautilusMimeIconEntryClass {
|
||||
GtkVBoxClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
guint nautilus_mime_type_icon_entry_get_type (void);
|
||||
GtkWidget *nautilus_mime_type_icon_entry_new (const gchar *history_id,
|
||||
const gchar *browse_dialog_title);
|
||||
|
||||
/*by default gnome_pixmap entry sets the default directory to the
|
||||
gnome pixmap directory, this will set it to a subdirectory of that,
|
||||
or one would use the file_entry functions for any other path*/
|
||||
void nautilus_mime_type_icon_entry_set_pixmap_subdir(NautilusMimeIconEntry *ientry,
|
||||
const gchar *subdir);
|
||||
void nautilus_mime_type_icon_entry_set_icon(NautilusMimeIconEntry *ientry,
|
||||
const gchar *filename);
|
||||
GtkWidget *nautilus_mime_type_icon_entry_gnome_file_entry(NautilusMimeIconEntry *ientry);
|
||||
GtkWidget *nautilus_mime_type_icon_entry_gnome_entry (NautilusMimeIconEntry *ientry);
|
||||
GtkWidget *nautilus_mime_type_icon_entry_gtk_entry (NautilusMimeIconEntry *ientry);
|
||||
|
||||
/*only return a file if it was possible to load it with imlib*/
|
||||
gchar *nautilus_mime_type_icon_entry_get_filename (NautilusMimeIconEntry *ientry);
|
||||
void nautilus_mime_type_show_icon_selection (NautilusMimeIconEntry * ientry);
|
||||
|
||||
END_GNOME_DECLS
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue