[easytag] Move file status icons into the filename entry



commit 528d48b41a70adf4824a28d757c3f7893e1defbd
Author: David King <amigadave amigadave com>
Date:   Thu Mar 21 17:50:48 2013 +0000

    Move file status icons into the filename entry
    
    Instead of the custom file status icons, use the standard
    "emblem-readonly" and "emblem-unreadable" emblems. Additionally, move
    the icons from a GtkImage to inside the filename GtkEntry. Update the
    tooltip text.

 Makefile.am                |    2 -
 data/pixmaps/forbidden.xpm |   91 -----------------------------
 data/pixmaps/read_only.xpm |  138 --------------------------------------------
 src/easytag.c              |    8 ---
 src/easytag.h              |    2 -
 src/et_core.c              |   24 ++++++--
 src/misc.c                 |    4 -
 7 files changed, 18 insertions(+), 251 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5350b3b..8f8056f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,14 +159,12 @@ pixmaps = \
        data/pixmaps/blackwhite.xpm \
        data/pixmaps/first_letter_uppercase.xpm \
        data/pixmaps/first_letter_uppercase_word.xpm \
-       data/pixmaps/forbidden.xpm \
        data/pixmaps/freedb.xpm \
        data/pixmaps/gnudb.xpm \
        data/pixmaps/grab.xpm \
        data/pixmaps/invert_selection.xpm \
        data/pixmaps/mask.xpm \
        data/pixmaps/musicbrainz.xpm \
-       data/pixmaps/read_only.xpm \
        data/pixmaps/red_lines.xpm \
        data/pixmaps/sequence_track.xpm \
        data/pixmaps/sound.xpm \
diff --git a/src/easytag.c b/src/easytag.c
index 84643a7..fe02b94 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -523,14 +523,6 @@ Create_File_Area (void)
     gtk_editable_set_editable(GTK_EDITABLE(FileEntry), TRUE);
     gtk_box_pack_start(GTK_BOX(HBox),FileEntry,TRUE,TRUE,2);
 
-    /* Access status icon */
-    ReadOnlyStatusIconBox = Create_Pixmap_Icon_With_Event_Box("easytag-read-only");
-    gtk_box_pack_start(GTK_BOX(HBox),ReadOnlyStatusIconBox,FALSE,FALSE,0);
-    gtk_widget_set_tooltip_text(ReadOnlyStatusIconBox,_("Read-only File"));
-    BrokenStatusIconBox = Create_Pixmap_Icon_With_Event_Box(GTK_STOCK_MISSING_IMAGE);
-    gtk_box_pack_start(GTK_BOX(HBox),BrokenStatusIconBox,FALSE,FALSE,0);
-    gtk_widget_set_tooltip_text(BrokenStatusIconBox,_("File Link Broken"));
-
     Attach_Popup_Menu_To_Tag_Entries(GTK_ENTRY(FileEntry));
 
 
diff --git a/src/easytag.h b/src/easytag.h
index 7822b2f..889c09d 100644
--- a/src/easytag.h
+++ b/src/easytag.h
@@ -48,8 +48,6 @@ GtkWidget *TagArea;
 GtkWidget *StatusArea;
 GtkWidget *ProgressArea;
 GtkWidget *LogArea;
-GtkWidget *ReadOnlyStatusIconBox;
-GtkWidget *BrokenStatusIconBox;
 GtkWidget *MainWindowHPaned;
 GtkWidget *MainWindowVPaned;
 
diff --git a/src/et_core.c b/src/et_core.c
index 19c212d..0d8f1a6 100644
--- a/src/et_core.c
+++ b/src/et_core.c
@@ -2683,6 +2683,7 @@ void ET_Display_File_Data_To_UI (ET_File *ETFile)
 static void
 ET_Display_File_And_List_Status_To_UI (ET_File *ETFile)
 {
+    /* FIXME: Use GFile. */
     FILE *file;
     gchar *text;
     gchar *cur_filename;
@@ -2694,25 +2695,36 @@ ET_Display_File_And_List_Status_To_UI (ET_File *ETFile)
     /* Show/hide 'AccessStatusIcon' */
     if ( (file=fopen(cur_filename,"r+b"))!=NULL )
     {
-        gtk_widget_hide(ReadOnlyStatusIconBox);
-        gtk_widget_hide(BrokenStatusIconBox);
+        gtk_entry_set_icon_from_gicon (GTK_ENTRY (FileEntry),
+                                       GTK_ENTRY_ICON_SECONDARY, NULL);
         fclose(file);
     }else
     {
+        GIcon *emblem_icon;
+        const gchar *message;
+
         switch(errno)
         {
             case EACCES:    /* Permission denied */
             case EROFS:     /* Read-only file system */
                 /* Read only file */
-                gtk_widget_show_all(ReadOnlyStatusIconBox);
-                gtk_widget_hide(BrokenStatusIconBox);
+                emblem_icon = g_themed_icon_new ("emblem-readonly");
+                message = _("Read-only file");
                 break;
             case ENOENT:    /* No such file or directory */
             default:
                 /* File not found */
-                gtk_widget_show_all(BrokenStatusIconBox);
-                gtk_widget_hide(ReadOnlyStatusIconBox);
+                emblem_icon = g_themed_icon_new ("emblem-unreadable");
+                message = _("File not found");
+                break;
         }
+
+        gtk_entry_set_icon_from_gicon (GTK_ENTRY (FileEntry),
+                                       GTK_ENTRY_ICON_SECONDARY,
+                                       emblem_icon);
+        gtk_entry_set_icon_tooltip_text (GTK_ENTRY (FileEntry),
+                                         GTK_ENTRY_ICON_SECONDARY, message);
+        g_object_unref (emblem_icon);
     }
 
     /* Show position of current file in list */
diff --git a/src/misc.c b/src/misc.c
index f6a6358..ae24b74 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -618,11 +618,9 @@ void Set_Unbusy_Cursor (void)
 //#include "data/pixmaps/blackwhite.xpm"
 #include "data/pixmaps/first_letter_uppercase.xpm"
 #include "data/pixmaps/first_letter_uppercase_word.xpm"
-#include "data/pixmaps/forbidden.xpm"
 #include "data/pixmaps/grab.xpm"
 #include "data/pixmaps/invert_selection.xpm"
 #include "data/pixmaps/mask.xpm"
-#include "data/pixmaps/read_only.xpm"
 #include "data/pixmaps/red_lines.xpm"
 //#include "data/pixmaps/sequence_track.xpm"
 #include "data/pixmaps/sound.xpm"
@@ -636,8 +634,6 @@ void Init_Custom_Icons (void)
     Create_Xpm_Icon_Factory((const char**)grab_xpm,                 "easytag-grab");
     Create_Xpm_Icon_Factory((const char**)mask_xpm,                 "easytag-mask");
     //Create_Xpm_Icon_Factory((const char**)blackwhite_xpm,         "easytag-blackwhite");
-    Create_Xpm_Icon_Factory((const char**)forbidden_xpm,            "easytag-forbidden");
-    Create_Xpm_Icon_Factory((const char**)read_only_xpm,            "easytag-read-only");
     //Create_Xpm_Icon_Factory((const char**)sequence_track_xpm,     "easytag-sequence-track");
     Create_Xpm_Icon_Factory((const char**)red_lines_xpm,            "easytag-red-lines");
     Create_Xpm_Icon_Factory((const char**)artist_album_xpm,     "easytag-artist-album");


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