summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndy Hertzfeld <andy@src.gnome.org>2000-02-14 07:23:10 +0000
committerAndy Hertzfeld <andy@src.gnome.org>2000-02-14 07:23:10 +0000
commit6245e766c4578565c539a32889fb819f3a5e6e9e (patch)
treeb48e290332ef4f32e07672118a9a7e922c1e63da /src
parentc85bb8ca4ad71530694f00cecb28a9cb686012cc (diff)
downloadnautilus-6245e766c4578565c539a32889fb819f3a5e6e9e.tar.gz
made index panel display "notes" from metadata if present, made it use
made index panel display "notes" from metadata if present, made it use custom icons from metadata if present.
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-index-title.c30
-rw-r--r--src/nautilus-information-panel.c7
-rw-r--r--src/nautilus-sidebar-title.c30
-rw-r--r--src/nautilus-sidebar.c7
-rw-r--r--src/ntl-index-panel.c7
5 files changed, 75 insertions, 6 deletions
diff --git a/src/nautilus-index-title.c b/src/nautilus-index-title.c
index 69287c1c9..8b36a475f 100644
--- a/src/nautilus-index-title.c
+++ b/src/nautilus-index-title.c
@@ -60,6 +60,7 @@ struct _NautilusIndexTitleDetails
GtkWidget *icon;
GtkWidget *title;
GtkWidget *more_info;
+ GtkWidget *notes;
};
/* button assignments */
@@ -111,6 +112,7 @@ nautilus_index_title_initialize (NautilusIndexTitle *index_title)
index_title->details->icon = NULL;
index_title->details->title = NULL;
index_title->details->more_info = NULL;
+ index_title->details->notes = NULL;
}
/* finalize by throwing away private storage */
@@ -246,12 +248,15 @@ void
nautilus_index_title_set_up_info (NautilusIndexTitle *index_title, NautilusFile *file_object)
{
GdkFont *label_font;
+ gchar *notes_text;
gchar *temp_string = NULL;
gchar *info_string = nautilus_file_get_string_attribute(file_object, "type");
if (info_string == NULL)
return;
+ /* combine the type and the size */
+
temp_string = nautilus_file_get_string_attribute(file_object, "size");
if (temp_string != NULL)
{
@@ -261,6 +266,7 @@ nautilus_index_title_set_up_info (NautilusIndexTitle *index_title, NautilusFile
info_string = new_info_string;
}
+ /* append the date modified */
temp_string = nautilus_file_get_string_attribute(file_object, "date_modified");
if (temp_string != NULL)
{
@@ -284,6 +290,30 @@ nautilus_index_title_set_up_info (NautilusIndexTitle *index_title, NautilusFile
set_up_font(index_title->details->more_info, label_font);
g_free(info_string);
+
+ /* see if there are any notes for this file. If so, display them */
+ notes_text = nautilus_file_get_metadata(file_object, "notes", NULL);
+ if (notes_text)
+ {
+ if (index_title->details->notes)
+ gtk_label_set_text(GTK_LABEL(index_title->details->notes), notes_text);
+ else
+ {
+ index_title->details->notes = GTK_WIDGET(gtk_label_new(notes_text));
+ gtk_label_set_line_wrap(GTK_LABEL(index_title->details->notes), TRUE);
+ gtk_widget_show (index_title->details->notes);
+ gtk_box_pack_start (GTK_BOX (index_title), index_title->details->notes, 0, 0, 0);
+ }
+
+ /* FIXME: don't use hardwired font like this */
+ label_font = gdk_font_load("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
+ set_up_font(index_title->details->notes, label_font);
+
+ g_free (notes_text);
+ }
+ else
+ if (index_title->details->notes)
+ gtk_label_set_text(GTK_LABEL(index_title->details->notes), "");
}
/* here's the place where we set everything up passed on the passed in uri */
diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c
index 984613edd..84d6f975b 100644
--- a/src/nautilus-information-panel.c
+++ b/src/nautilus-information-panel.c
@@ -72,13 +72,15 @@ static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, c
/* drag and drop definitions */
enum {
+ TARGET_URI_LIST,
TARGET_COLOR,
- TARGET_URI_LIST
+ TARGET_GNOME_URI_LIST
};
static GtkTargetEntry index_dnd_target_table[] = {
+ { "text/uri-list", 0, TARGET_URI_LIST },
{ "application/x-color", 0, TARGET_COLOR },
- { "text/uri-list", 0, TARGET_URI_LIST }
+ { "special/x-gnome-icon-list", 0, TARGET_GNOME_URI_LIST }
};
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIndexPanel, nautilus_index_panel, GTK_TYPE_EVENT_BOX)
@@ -192,6 +194,7 @@ nautilus_index_panel_drag_data_received (GtkWidget *widget, GdkDragContext *cont
switch (info)
{
+ case TARGET_GNOME_URI_LIST:
case TARGET_URI_LIST:
g_message("dropped data on index panel: %s", selection_data->data);
diff --git a/src/nautilus-sidebar-title.c b/src/nautilus-sidebar-title.c
index 69287c1c9..8b36a475f 100644
--- a/src/nautilus-sidebar-title.c
+++ b/src/nautilus-sidebar-title.c
@@ -60,6 +60,7 @@ struct _NautilusIndexTitleDetails
GtkWidget *icon;
GtkWidget *title;
GtkWidget *more_info;
+ GtkWidget *notes;
};
/* button assignments */
@@ -111,6 +112,7 @@ nautilus_index_title_initialize (NautilusIndexTitle *index_title)
index_title->details->icon = NULL;
index_title->details->title = NULL;
index_title->details->more_info = NULL;
+ index_title->details->notes = NULL;
}
/* finalize by throwing away private storage */
@@ -246,12 +248,15 @@ void
nautilus_index_title_set_up_info (NautilusIndexTitle *index_title, NautilusFile *file_object)
{
GdkFont *label_font;
+ gchar *notes_text;
gchar *temp_string = NULL;
gchar *info_string = nautilus_file_get_string_attribute(file_object, "type");
if (info_string == NULL)
return;
+ /* combine the type and the size */
+
temp_string = nautilus_file_get_string_attribute(file_object, "size");
if (temp_string != NULL)
{
@@ -261,6 +266,7 @@ nautilus_index_title_set_up_info (NautilusIndexTitle *index_title, NautilusFile
info_string = new_info_string;
}
+ /* append the date modified */
temp_string = nautilus_file_get_string_attribute(file_object, "date_modified");
if (temp_string != NULL)
{
@@ -284,6 +290,30 @@ nautilus_index_title_set_up_info (NautilusIndexTitle *index_title, NautilusFile
set_up_font(index_title->details->more_info, label_font);
g_free(info_string);
+
+ /* see if there are any notes for this file. If so, display them */
+ notes_text = nautilus_file_get_metadata(file_object, "notes", NULL);
+ if (notes_text)
+ {
+ if (index_title->details->notes)
+ gtk_label_set_text(GTK_LABEL(index_title->details->notes), notes_text);
+ else
+ {
+ index_title->details->notes = GTK_WIDGET(gtk_label_new(notes_text));
+ gtk_label_set_line_wrap(GTK_LABEL(index_title->details->notes), TRUE);
+ gtk_widget_show (index_title->details->notes);
+ gtk_box_pack_start (GTK_BOX (index_title), index_title->details->notes, 0, 0, 0);
+ }
+
+ /* FIXME: don't use hardwired font like this */
+ label_font = gdk_font_load("-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*");
+ set_up_font(index_title->details->notes, label_font);
+
+ g_free (notes_text);
+ }
+ else
+ if (index_title->details->notes)
+ gtk_label_set_text(GTK_LABEL(index_title->details->notes), "");
}
/* here's the place where we set everything up passed on the passed in uri */
diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c
index 984613edd..84d6f975b 100644
--- a/src/nautilus-sidebar.c
+++ b/src/nautilus-sidebar.c
@@ -72,13 +72,15 @@ static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, c
/* drag and drop definitions */
enum {
+ TARGET_URI_LIST,
TARGET_COLOR,
- TARGET_URI_LIST
+ TARGET_GNOME_URI_LIST
};
static GtkTargetEntry index_dnd_target_table[] = {
+ { "text/uri-list", 0, TARGET_URI_LIST },
{ "application/x-color", 0, TARGET_COLOR },
- { "text/uri-list", 0, TARGET_URI_LIST }
+ { "special/x-gnome-icon-list", 0, TARGET_GNOME_URI_LIST }
};
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIndexPanel, nautilus_index_panel, GTK_TYPE_EVENT_BOX)
@@ -192,6 +194,7 @@ nautilus_index_panel_drag_data_received (GtkWidget *widget, GdkDragContext *cont
switch (info)
{
+ case TARGET_GNOME_URI_LIST:
case TARGET_URI_LIST:
g_message("dropped data on index panel: %s", selection_data->data);
diff --git a/src/ntl-index-panel.c b/src/ntl-index-panel.c
index 984613edd..84d6f975b 100644
--- a/src/ntl-index-panel.c
+++ b/src/ntl-index-panel.c
@@ -72,13 +72,15 @@ static void nautilus_index_panel_set_up_info (NautilusIndexPanel *index_panel, c
/* drag and drop definitions */
enum {
+ TARGET_URI_LIST,
TARGET_COLOR,
- TARGET_URI_LIST
+ TARGET_GNOME_URI_LIST
};
static GtkTargetEntry index_dnd_target_table[] = {
+ { "text/uri-list", 0, TARGET_URI_LIST },
{ "application/x-color", 0, TARGET_COLOR },
- { "text/uri-list", 0, TARGET_URI_LIST }
+ { "special/x-gnome-icon-list", 0, TARGET_GNOME_URI_LIST }
};
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusIndexPanel, nautilus_index_panel, GTK_TYPE_EVENT_BOX)
@@ -192,6 +194,7 @@ nautilus_index_panel_drag_data_received (GtkWidget *widget, GdkDragContext *cont
switch (info)
{
+ case TARGET_GNOME_URI_LIST:
case TARGET_URI_LIST:
g_message("dropped data on index panel: %s", selection_data->data);