gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1118 - in gnunet-gtk: . src src/fs src/fs/extensions


From: grothoff
Subject: [GNUnet-SVN] r1118 - in gnunet-gtk: . src src/fs src/fs/extensions
Date: Tue, 28 Jun 2005 13:16:41 -0700 (PDT)

Author: grothoff
Date: 2005-06-28 13:16:36 -0700 (Tue, 28 Jun 2005)
New Revision: 1118

Added:
   gnunet-gtk/src/fs/
   gnunet-gtk/src/fs/extensions/
   gnunet-gtk/src/fs/extensions/musicinsert.c
   gnunet-gtk/src/fs/extensions/musicinsert.glade
   gnunet-gtk/src/fs/extensions/musicinsert.h
Modified:
   gnunet-gtk/AUTHORS
Log:
adding Milans code, not yet integrated

Modified: gnunet-gtk/AUTHORS
===================================================================
--- gnunet-gtk/AUTHORS  2005-06-28 20:11:49 UTC (rev 1117)
+++ gnunet-gtk/AUTHORS  2005-06-28 20:16:36 UTC (rev 1118)
@@ -4,7 +4,7 @@
 Code contributions also came from:
 Igor Wronsky <address@hidden>'
 Nils Durner <address@hidden>
+Milan <address@hidden>
 
-
 If you have contributed and are not listed here, please
 notify one of the maintainers in order to be added.

Added: gnunet-gtk/src/fs/extensions/musicinsert.c
===================================================================
--- gnunet-gtk/src/fs/extensions/musicinsert.c  2005-06-28 20:11:49 UTC (rev 
1117)
+++ gnunet-gtk/src/fs/extensions/musicinsert.c  2005-06-28 20:16:36 UTC (rev 
1118)
@@ -0,0 +1,782 @@
+/*
+     This file is part of GNUnet.
+     (C) 2005 Christian Grothoff (and other contributing authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/musicinsert.c
+ * @brief Music insertion dialog for gnunet-gtk
+ * @author Milan Bouchet
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+#include <glib-object.h>
+#include <glib.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <extractor.h>
+
+#include "main.h"
+
+/* platform.h will be needed */
+
+#define _ 
+
+int
+main (int argc, char *argv[])
+{
+
+
+
+  gtk_init(&argc, &argv);
+
+show_musicinsertdialog ();
+
+  gtk_main ();
+  return 0;
+}
+
+void show_musicinsertdialog ()
+{
+    musicinsertXML = glade_xml_new("../musicinsert.glade", 
"musicinsertdialog", NULL);
+       glade_xml_signal_autoconnect(musicinsertXML);
+/* libglade*/
+
+
+  gtk_set_locale ();
+
+  /*
+   * The following code was added by Glade to create one of each component
+   * (except popup menus), just so that you see something after building
+   * the project. Delete any components that you don't want shown initially.
+   */
+  //musicinsertdialog = create_musicinsertdialog ();
+  GtkWidget *musicinsertdialog;
+  musicinsertdialog = glade_xml_get_widget(musicinsertXML, 
"musicinsertdialog");
+
+/*
+ * Create the 3 ComboBoxEntry manually (libglade doesn't handle this well :
+ * should use gtk_combo_box_entry_new_text instead of gtk_combo_box_entry_new)
+ */
+       artistcombobox = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text ());
+       albumcombobox = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text ());
+       typecombobox = GTK_COMBO_BOX_ENTRY(gtk_combo_box_entry_new_text ());
+       
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "Ogg 
(application/ogg)");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "MP3 
(audio/mpeg)");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "MPC 
(application/x-musepack)");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "AAC");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "WMA 
(audio/x-ms-wma)");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "FLAC 
(audio/flac)");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "APE");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "WAV 
(application/x-wav)");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "REAL 
(audio/vnd.rn-realaudio)");
+       gtk_combo_box_append_text (GTK_COMBO_BOX(typecombobox), "MIDI 
(audio/x-midi)");
+       
+       GtkWidget *globaltable = glade_xml_get_widget (musicinsertXML, 
"globaltable");
+       gtk_table_attach (GTK_TABLE(globaltable), GTK_WIDGET(artistcombobox), 
1, 3, 1, 2, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+       gtk_table_attach (GTK_TABLE(globaltable), GTK_WIDGET(albumcombobox), 1, 
3, 2, 3, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+       gtk_table_attach (GTK_TABLE(globaltable), GTK_WIDGET(typecombobox), 1, 
3, 3, 4, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+
+       gtk_widget_show (GTK_WIDGET(artistcombobox));
+       gtk_widget_show (GTK_WIDGET(albumcombobox));
+       gtk_widget_show (GTK_WIDGET(typecombobox));
+
+  /*
+   * treeview creation 
+   */
+   
+   /* liststore model */
+  filelist_store =
+    gtk_list_store_new (COLS_NUMBER, G_TYPE_STRING, G_TYPE_STRING,
+                       G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+                       G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+                       
+  /* view */
+  GtkWidget *filelist = glade_xml_get_widget (musicinsertXML, "filelist");
+  gtk_tree_view_set_model (GTK_TREE_VIEW (filelist),
+                          GTK_TREE_MODEL (filelist_store));
+
+  /* cells definition */
+  GtkCellRenderer *filename_renderer = gtk_cell_renderer_text_new ();
+  g_object_set (filename_renderer, "editable", TRUE, NULL);
+  GtkCellRenderer *title_renderer = gtk_cell_renderer_text_new ();
+  g_object_set (title_renderer, "editable", TRUE, NULL);
+  GtkCellRenderer *artist_renderer = gtk_cell_renderer_text_new ();
+  g_object_set (artist_renderer, "editable", TRUE, NULL);
+  GtkCellRenderer *album_renderer = gtk_cell_renderer_text_new ();
+  g_object_set (album_renderer, "editable", TRUE, NULL);
+  GtkCellRenderer *type_renderer = gtk_cell_renderer_text_new ();
+  g_object_set (type_renderer, "editable", TRUE, NULL);
+  GtkCellRenderer *format_renderer = gtk_cell_renderer_text_new ();
+  g_object_set (format_renderer, "editable", TRUE, NULL);
+  GtkCellRenderer *keywords_renderer = gtk_cell_renderer_text_new ();
+  g_object_set (keywords_renderer, "editable", TRUE, NULL);
+
+
+  g_signal_connect ((gpointer) filename_renderer, "edited",
+                   G_CALLBACK (on_renderer_edited), (gpointer) 
&filename_col_num);
+  g_signal_connect ((gpointer) title_renderer, "edited",
+                   G_CALLBACK (on_renderer_edited), (gpointer) &title_col_num);
+  g_signal_connect ((gpointer) artist_renderer, "edited",
+                   G_CALLBACK (on_renderer_edited), (gpointer) 
&artist_col_num);
+  g_signal_connect ((gpointer) album_renderer, "edited",
+                   G_CALLBACK (on_renderer_edited), (gpointer) &album_col_num);
+  g_signal_connect ((gpointer) type_renderer, "edited",
+                   G_CALLBACK (on_renderer_edited), (gpointer) &type_col_num);
+  g_signal_connect ((gpointer) format_renderer, "edited",
+                   G_CALLBACK (on_renderer_edited), (gpointer) 
&format_col_num);
+  g_signal_connect ((gpointer) keywords_renderer, "edited",
+                   G_CALLBACK (on_renderer_edited), (gpointer) 
&keywords_col_num);
+
+  /* columns definition */
+  filename_list_col =
+    gtk_tree_view_column_new_with_attributes (_("Published filename"),
+                                             filename_renderer,
+                                             "text", FILENAME_COL, NULL);
+  title_list_col =
+    gtk_tree_view_column_new_with_attributes (_("Title"),
+                                             title_renderer,
+                                             "text", TITLE_COL, NULL);
+  artist_list_col =
+    gtk_tree_view_column_new_with_attributes (_("Artist"),
+                                             artist_renderer,
+                                             "text", ARTIST_COL, NULL);
+  album_list_col =
+    gtk_tree_view_column_new_with_attributes (_("Album"),
+                                             album_renderer,
+                                             "text", ALBUM_COL, NULL);
+  type_list_col =
+    gtk_tree_view_column_new_with_attributes (_("Type"),
+                                             type_renderer,
+                                             "text", TYPE_COL, NULL);
+  format_list_col =
+    gtk_tree_view_column_new_with_attributes (_("Format"),
+                                             format_renderer,
+                                             "text", FORMAT_COL, NULL);
+  keywords_list_col =
+    gtk_tree_view_column_new_with_attributes (_("Keywords"),
+                                             keywords_renderer,
+                                             "text", KEYWORDS_COL, NULL);
+
+/* Allow sorting for all columns */
+  gtk_tree_view_column_set_sort_column_id (filename_list_col, FILENAME_COL);
+  gtk_tree_view_column_set_sort_column_id (title_list_col, TITLE_COL);
+  gtk_tree_view_column_set_sort_column_id (artist_list_col, ARTIST_COL);
+  gtk_tree_view_column_set_sort_column_id (album_list_col, ALBUM_COL);
+  gtk_tree_view_column_set_sort_column_id (type_list_col, TYPE_COL);
+  gtk_tree_view_column_set_sort_column_id (format_list_col, FORMAT_COL);
+  gtk_tree_view_column_set_sort_column_id (keywords_list_col, KEYWORDS_COL);
+
+  /* Allow to resize all columns */
+  gtk_tree_view_column_set_resizable (filename_list_col, TRUE);
+  gtk_tree_view_column_set_resizable (title_list_col, TRUE);
+  gtk_tree_view_column_set_resizable (artist_list_col, TRUE);
+  gtk_tree_view_column_set_resizable (album_list_col, TRUE);
+  gtk_tree_view_column_set_resizable (type_list_col, TRUE);
+  gtk_tree_view_column_set_resizable (format_list_col, TRUE);
+  gtk_tree_view_column_set_resizable (keywords_list_col, TRUE);
+
+  /* Hide unedeed columns */
+  gtk_tree_view_column_set_visible (artist_list_col, FALSE);
+  gtk_tree_view_column_set_visible (album_list_col, FALSE);
+  gtk_tree_view_column_set_visible (type_list_col, FALSE);
+  gtk_tree_view_column_set_visible (keywords_list_col, FALSE);
+
+  /* Set a smart option */
+  gtk_tree_view_get_hover_expand (GTK_TREE_VIEW (filelist));
+
+  /* add columns to view */
+  gtk_tree_view_append_column (GTK_TREE_VIEW (filelist), filename_list_col);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (filelist), title_list_col);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (filelist), artist_list_col);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (filelist), album_list_col);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (filelist), type_list_col);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (filelist), format_list_col);
+  gtk_tree_view_append_column (GTK_TREE_VIEW (filelist), keywords_list_col);
+
+  /* Expand columns */
+  gtk_tree_view_column_set_expand (filename_list_col, TRUE);
+  gtk_tree_view_column_set_expand (artist_list_col, TRUE);
+  gtk_tree_view_column_set_expand (album_list_col, TRUE);
+  gtk_tree_view_column_set_expand (type_list_col, TRUE);
+  gtk_tree_view_column_set_expand (format_list_col, TRUE);
+  gtk_tree_view_column_set_expand (keywords_list_col, TRUE);
+
+  /* Allow multiple selections */
+  GtkTreeSelection *filelist_selection =
+    gtk_tree_view_get_selection (GTK_TREE_VIEW (filelist));
+  gtk_tree_selection_set_mode (filelist_selection, GTK_SELECTION_MULTIPLE);
+
+
+
+  AlbumList = NULL;
+  ArtistList = NULL;
+
+  Extractors = EXTRACTOR_loadDefaultLibraries ();
+  Extractors = EXTRACTOR_loadConfigLibraries (Extractors, 
"libextractor_filename");
+
+/* Create the popup menu */
+  filelist_popup = gtk_menu_new ();
+  GtkWidget *select_all_menu_item =
+    gtk_menu_item_new_with_label (_("Select all files"));
+  GtkWidget *delete_menu_item =
+    gtk_menu_item_new_with_label (_("Remove selected files"));
+  gtk_menu_attach (GTK_MENU (filelist_popup), select_all_menu_item, 0, 1, 0,
+                  1);
+  gtk_menu_attach (GTK_MENU (filelist_popup), delete_menu_item, 0, 1, 1, 2);
+  gtk_widget_show (select_all_menu_item);
+  gtk_widget_show (delete_menu_item);
+  gtk_signal_connect (GTK_OBJECT (filelist), "button-press-event",
+                     GTK_SIGNAL_FUNC (popup_delete), (gpointer) NULL);
+  gtk_signal_connect (GTK_OBJECT (select_all_menu_item), "activate",
+                     GTK_SIGNAL_FUNC (select_all_files), (gpointer) TRUE);
+  gtk_signal_connect (GTK_OBJECT (delete_menu_item), "activate",
+                     GTK_SIGNAL_FUNC (remove_file_from_list),
+                     (gpointer) NULL);
+
+  /*
+   * show the main window 
+   */
+  gtk_widget_show (musicinsertdialog);
+}
+
+/**
+ * @brief Get an EXTRACTOR_KeywordList for a specified file
+ * @param a pointer to the extractors used to get the keywords
+ * @param the name of the file to extract the keywords from
+ */
+EXTRACTOR_KeywordList *
+get_EXTRACTORKeywords (const EXTRACTOR_ExtractorList
+                      * exList, const char *filename)
+{
+  EXTRACTOR_KeywordList *keyList;
+
+  keyList =
+    EXTRACTOR_getKeywords ((EXTRACTOR_ExtractorList *) exList, filename);
+  keyList =
+    EXTRACTOR_removeDuplicateKeywords (keyList,
+                                      EXTRACTOR_DUPLICATES_REMOVE_UNKNOWN);
+  keyList = EXTRACTOR_removeEmptyKeywords (keyList);
+  return keyList;
+}
+
+
+
+/**
+ * @brief Get an EXTRACTOR_KeywordList for a specified file
+ * @param a pointer to the extractors used to get the keywords
+ * @param the name of the file to extract the keywords from
+ */
+void
+set_File_Keywords (const gchar * filename)
+{
+  char *keywords[7];
+  GtkTreeIter pIter;
+
+  EXTRACTOR_KeywordList *KeywordList =
+    get_EXTRACTORKeywords (Extractors, filename);
+
+
+  keywords[0] = (char *) EXTRACTOR_extractLast (EXTRACTOR_FILENAME, 
KeywordList);
+
+  keywords[1] = (char *) EXTRACTOR_extractLast (EXTRACTOR_FILENAME, 
KeywordList);
+
+  keywords[2] = (char *) EXTRACTOR_extractLast (EXTRACTOR_TITLE, KeywordList);
+
+  keywords[3] =
+    (char *) EXTRACTOR_extractLast (EXTRACTOR_ARTIST, KeywordList);
+  if (keywords[3] != '\0'
+      && (g_list_find_custom (ArtistList, keywords[3], (GCompareFunc) strcmp) 
== NULL))
+    {
+      ArtistList = g_list_append (ArtistList, STRDUP(keywords[3]));
+      gtk_combo_box_append_text (GTK_COMBO_BOX
+                                (artistcombobox), keywords[3]);
+    }
+
+  keywords[4] = (char *) EXTRACTOR_extractLast (EXTRACTOR_ALBUM, KeywordList);
+  if (keywords[4] != '\0'
+      && (g_list_find_custom (AlbumList, keywords[4], (GCompareFunc) strcmp)) 
== NULL)
+    {
+      AlbumList = g_list_append (AlbumList, STRDUP(keywords[4]));
+      gtk_combo_box_append_text (GTK_COMBO_BOX
+                                (albumcombobox), keywords[4]);
+    }
+
+  keywords[5] =
+    (char *) EXTRACTOR_extractLast (EXTRACTOR_MIMETYPE, KeywordList);
+  if (keywords[5] != '\0')
+    {
+      if ((g_list_find_custom (TypeList, keywords[5], (GCompareFunc) strcmp)) 
== NULL)
+       TypeList = g_list_append (TypeList, STRDUP(keywords[5]));
+
+      if (strcmp (keywords[5], "application/ogg") == 0)
+       gtk_combo_box_set_active (GTK_COMBO_BOX
+                                 (typecombobox),
+                                 FORMAT_OGG);
+      else if (strcmp (keywords[5], "audio/mpeg") == 0)
+       gtk_combo_box_set_active
+         (GTK_COMBO_BOX
+          (typecombobox), FORMAT_MP3);
+      else if (strcmp (keywords[5], "application/x-wav") == 0)
+       gtk_combo_box_set_active
+         (GTK_COMBO_BOX
+          (typecombobox), FORMAT_WAV);
+      else if (strcmp (keywords[5], "audio/vnd.rn-realaudio") == 0)
+       gtk_combo_box_set_active
+         (GTK_COMBO_BOX
+          (typecombobox), FORMAT_REAL);
+    }
+  else
+    {
+      TypeList = g_list_append (TypeList, STRDUP("unspecified"));
+    }
+
+  keywords[6] =
+    (char *) EXTRACTOR_extractLast (EXTRACTOR_FORMAT, KeywordList);
+
+  gtk_list_store_append (filelist_store, &pIter);
+  gtk_list_store_set (filelist_store, &pIter, REAL_FILENAME_COL, keywords[0],
+                     FILENAME_COL, keywords[1], TITLE_COL, keywords[2],
+                     ARTIST_COL, keywords[3], ALBUM_COL, keywords[4],
+                     TYPE_COL, keywords[5], FORMAT_COL, keywords[6],
+                     KEYWORDS_COL, "", -1);
+  EXTRACTOR_freeKeywords (KeywordList);
+  return;
+}
+
+/**
+ * @brief Select entries in combo boxes based on per-file infos
+ */
+void
+activateComboBoxes ()
+{
+
+  if (gtk_combo_box_get_active (GTK_COMBO_BOX (albumcombobox)) < 0
+      &&
+      gtk_tree_model_iter_n_children (gtk_combo_box_get_model
+                                     (GTK_COMBO_BOX (albumcombobox)),
+                                     NULL) != 0)
+  gtk_combo_box_set_active (GTK_COMBO_BOX
+                             (albumcombobox), 0);
+
+  if (gtk_combo_box_get_active (GTK_COMBO_BOX (artistcombobox)) < 0
+      &&
+      gtk_tree_model_iter_n_children (gtk_combo_box_get_model
+                                     (GTK_COMBO_BOX (artistcombobox)),
+                                     NULL) != 0)
+    gtk_combo_box_set_active (GTK_COMBO_BOX
+                             (artistcombobox), 0);
+
+  if (gtk_combo_box_get_active (GTK_COMBO_BOX (typecombobox)) < 0
+      &&
+      gtk_tree_model_iter_n_children (gtk_combo_box_get_model
+                                     (GTK_COMBO_BOX (typecombobox)),
+                                     NULL) != 0)
+    gtk_combo_box_set_active (GTK_COMBO_BOX
+                             (typecombobox), 0);
+
+  return;
+}
+
+/**
+ * @brief Hide or show specific columns if needed
+ */
+void
+updateColumns ()
+{
+  if (g_list_length (ArtistList) > 1)
+    gtk_tree_view_column_set_visible (type_list_col, TRUE);
+  else
+    gtk_tree_view_column_set_visible (type_list_col, FALSE);
+
+  if (g_list_length (AlbumList) > 1)
+    gtk_tree_view_column_set_visible (type_list_col, TRUE);
+  else
+    gtk_tree_view_column_set_visible (type_list_col, FALSE);
+
+  if (g_list_length (TypeList) > 1)
+    gtk_tree_view_column_set_visible (type_list_col, TRUE);
+  else
+    gtk_tree_view_column_set_visible (type_list_col, FALSE);
+
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (filelist_store),
+                                       FILENAME_COL, GTK_SORT_ASCENDING);
+}
+
+/**
+ * @brief Get an EXTRACTOR_KeywordList for a specified file
+ * @param a pointer to the extractors used to get the keywords
+ * @param the name of the file to extract the keywords from
+ *
+int inv_strcomp (gconstpointer a, gconstpointer b)
+{
+       return !strcmp ((char *)a, (char *)b);
+}
+*/
+/* Callback functions */
+
+/**
+ * @brief Called when musicinsertdialog is destroyed (callback)
+ */
+void
+on_musicinsertdialog_destroy (GtkObject * object, gpointer user_data)
+{
+  gtk_main_quit ();
+}
+
+/**
+ * @brief Called when 'Cancel' button is clicked (callback)
+ */
+void
+on_cancelbutton_clicked (GtkButton * button, gpointer user_data)
+{
+  gtk_main_quit ();
+}
+
+/**
+ * @brief Called when the user validates the insertion (callback)
+ */
+void
+on_okbutton_clicked (GtkButton * button, gpointer user_data)
+{
+  return;
+}
+
+/**
+ * @brief Called when the 'Add a directory' button is clicked (callback)
+ */
+void
+on_diraddbutton_clicked (GtkButton * button, gpointer user_data)
+{
+  gchar *path;
+GtkWidget *musicinsertdialog = glade_xml_get_widget(musicinsertXML, 
"musicinsertdialog");
+  /* choose the directory to list */
+  GtkWidget *filechooser =
+    gtk_file_chooser_dialog_new (_("Choose the directory to insert..."),
+                                GTK_WINDOW (musicinsertdialog),
+                                GTK_FILE_CHOOSER_ACTION_OPEN,
+                                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                                NULL);
+  gtk_file_chooser_set_action (GTK_FILE_CHOOSER (filechooser),
+                              GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+  gtk_window_set_modal (GTK_WINDOW (filechooser), TRUE);
+  switch (gtk_dialog_run (GTK_DIALOG (filechooser)))
+    {
+    case GTK_RESPONSE_ACCEPT:
+      /* get the path */
+      path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser));
+      gtk_widget_destroy (filechooser);
+      break;
+    default:
+      gtk_widget_destroy (filechooser);
+      return;
+    }
+
+  /* list directory and fill the fields */
+  GDir *directory;
+  GString *long_filename;
+  GError *dir_opening_error;
+  GSList *file_error_list = NULL;
+  gchar *filename;
+  if ((directory = g_dir_open (path, 0, &dir_opening_error)))
+    {
+      while ((filename = (gchar *) g_dir_read_name (directory)))
+       {
+         long_filename = g_string_new (path);
+         g_string_append_c (long_filename, DIR_SEPARATOR);
+         g_string_append (long_filename, filename);
+         if (!(ACCESS (long_filename->str, F_OK | R_OK)))
+           {
+             if (!(g_file_test (long_filename->str, G_FILE_TEST_IS_DIR)))
+               set_File_Keywords (long_filename->str);
+           }
+         else
+           {
+             file_error_list = g_slist_append (file_error_list, filename);
+             g_string_free (long_filename, TRUE);
+           }
+       }
+
+      g_free (path);
+      activateComboBoxes ();
+      updateColumns ();
+      if (g_slist_length (file_error_list) > 0)
+       {
+         GString *file_error_message =
+           g_string_new (_
+                         ("The following files won't be added for I could not 
read them :"));
+         while ((file_error_list = g_slist_next (file_error_list)))
+           {
+             g_string_append_c (file_error_message, '\n');
+             g_string_append (file_error_message,
+                              (gchar *) file_error_list->data);
+           }
+         GtkWidget *file_error_dialog =
+           gtk_message_dialog_new (GTK_WINDOW (musicinsertdialog),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+                                   file_error_message->str);
+         gtk_dialog_run (GTK_DIALOG (file_error_dialog));
+         gtk_widget_destroy (file_error_dialog);
+         g_string_free (file_error_message, TRUE);
+       }
+      g_dir_close (directory);
+    }
+  else
+    {
+      gchar *error_message = STRDUP (_("Could not open the directory :\n"));
+      GtkWidget *message_dialog =
+       gtk_message_dialog_new (GTK_WINDOW (musicinsertdialog),
+                               GTK_DIALOG_DESTROY_WITH_PARENT,
+                               GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+                               "%s%s", error_message,
+                               dir_opening_error->message);
+      gtk_dialog_run (GTK_DIALOG (message_dialog));
+      gtk_widget_destroy (message_dialog);
+      g_free (error_message);
+      g_error_free (dir_opening_error);
+    }
+}
+
+/**
+ * @brief Called when the 'Add a file' button is clicked (callback)
+ */
+void
+on_fileaddbutton_clicked (GtkButton * button, gpointer user_data)
+{
+  GSList *pathlist;
+GtkWidget *musicinsertdialog = glade_xml_get_widget(musicinsertXML, 
"musicinsertdialog");
+  /* choose the file to add */
+  GtkWidget *filechooser =
+    gtk_file_chooser_dialog_new (_("Choose files to insert..."),
+                                GTK_WINDOW (musicinsertdialog),
+                                GTK_FILE_CHOOSER_ACTION_OPEN,
+                                GTK_STOCK_CANCEL,
+                                GTK_RESPONSE_CANCEL,
+                                GTK_STOCK_OPEN,
+                                GTK_RESPONSE_ACCEPT, NULL);
+  gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (filechooser), TRUE);
+  gtk_window_set_modal (GTK_WINDOW (filechooser), TRUE);
+
+  if (gtk_dialog_run (GTK_DIALOG (filechooser)) == GTK_RESPONSE_ACCEPT)
+    {
+      GSList *file_error_list = NULL;
+      /* get the path */
+      pathlist =
+       gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (filechooser));
+      gtk_widget_destroy (filechooser);
+      do
+       {
+         if (!(ACCESS (pathlist->data, F_OK | R_OK)))
+           {
+             set_File_Keywords (pathlist->data);
+           }
+         else
+           {
+             file_error_list =
+               g_slist_append (file_error_list, pathlist->data);
+           }
+       }
+      while ((pathlist = g_slist_next (pathlist)));
+      g_slist_free (pathlist);
+
+      activateComboBoxes ();
+      updateColumns ();
+
+      if (g_slist_length (file_error_list) > 0)
+       {
+         GString *file_error_message =
+           g_string_new (_
+                         ("The following files won't be added for I could not 
read them :"));
+         while ((file_error_list = g_slist_next (file_error_list)))
+           {
+             g_string_append_c (file_error_message, '\n');
+             g_string_append (file_error_message,
+                              (gchar *) file_error_list->data);
+           }
+
+         GtkWidget *file_error_dialog =
+           gtk_message_dialog_new (GTK_WINDOW (musicinsertdialog),
+                                   GTK_DIALOG_DESTROY_WITH_PARENT,
+                                   GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+                                   file_error_message->str);
+         gtk_dialog_run (GTK_DIALOG (file_error_dialog));
+         g_string_free (file_error_message, TRUE);
+         gtk_widget_destroy (file_error_dialog);
+       }
+      return;
+    }
+  else
+    {
+      gtk_widget_destroy (filechooser);
+      return;
+    }
+}
+
+/**
+ * @brief Called when the user chooses the 'Full insertion' toggle button
+ */
+void
+on_radioinsert_toggled (GtkRadioButton * radiobutton, gpointer user_data)
+{
+  gtk_widget_set_sensitive (GTK_WIDGET
+                           (glade_xml_get_widget (musicinsertXML, 
"copyfilesbutton")), FALSE);
+}
+
+/**
+ * @brief Called when the user chooses the 'Index only' toggle button
+ */
+void
+on_radioindex_toggled (GtkRadioButton * radiobutton, gpointer user_data)
+{
+  gtk_widget_set_sensitive
+    (GTK_WIDGET (glade_xml_get_widget (musicinsertXML, "copyfilesbutton")), 
TRUE);
+}
+
+/**
+ * @brief Hide or show the album column when needed
+ */
+void
+  on_albumtogglebutton_toggled
+  (GtkToggleButton * togglebutton, gpointer user_data)
+{
+  if (gtk_toggle_button_get_active (togglebutton))
+    gtk_tree_view_column_set_visible (album_list_col, FALSE);
+  else
+    gtk_tree_view_column_set_visible (album_list_col, TRUE);
+}
+
+/**
+ * @brief Hide or show the artist column when needed
+ */
+void
+  on_artisttogglebutton_toggled
+  (GtkToggleButton * togglebutton, gpointer user_data)
+{
+  if (gtk_toggle_button_get_active (togglebutton))
+    gtk_tree_view_column_set_visible (artist_list_col, FALSE);
+  else
+    gtk_tree_view_column_set_visible (artist_list_col, TRUE);
+}
+
+/**
+ * @brief Hide or show the keywords column when needed
+ */
+void
+  on_keywordstogglebutton_toggled
+  (GtkToggleButton * togglebutton, gpointer user_data)
+{
+  if (gtk_toggle_button_get_active (togglebutton))
+    gtk_tree_view_column_set_visible (keywords_list_col, FALSE);
+  else
+    gtk_tree_view_column_set_visible (keywords_list_col, TRUE);
+}
+
+/**
+ * @brief Make to user able to modify the per-file data
+ */
+void
+  on_renderer_edited
+  (GtkCellRendererText *
+   cellrenderertext,
+   gchar * path_string, gchar * new_text, gpointer user_data)
+{
+  GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
+  GtkTreeIter iter;
+  gtk_tree_model_get_iter (GTK_TREE_MODEL (filelist_store), &iter, path);
+  gtk_list_store_set (filelist_store, &iter,
+                     (gint) * ((gint *) user_data), new_text, -1);
+  gtk_tree_path_free (path);
+}
+
+gboolean
+popup_delete (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
+{
+  if ((event->type == GDK_BUTTON_PRESS) && (event->button == 3))
+    {
+      gtk_menu_popup (GTK_MENU (filelist_popup), NULL, NULL, NULL, NULL,
+                     event->button, event->time);
+      return TRUE;
+    }
+  return FALSE;
+}
+
+/**
+ * @brief Remove a file from the list to insert
+ */
+void
+remove_file_from_list (gpointer user_data)
+{
+  GtkTreeIter iter;
+  GtkWidget *filelist = glade_xml_get_widget (musicinsertXML, "filelist");
+  GtkTreeSelection *selection =
+    gtk_tree_view_get_selection (GTK_TREE_VIEW (filelist));
+  GList *selected_paths = gtk_tree_selection_get_selected_rows (selection,
+                                                               (GtkTreeModel
+                                                                **) &
+                                                               filelist_store);
+  GList *selected_refs = NULL;
+  GtkTreePath *path;
+/* Get static references from paths */
+  while (selected_paths)
+    {
+      selected_refs = g_list_append (selected_refs,
+                                    gtk_tree_row_reference_new
+                                    (GTK_TREE_MODEL (filelist_store),
+                                     selected_paths->data));
+      selected_paths = g_list_next (selected_paths);
+    }
+  g_list_foreach (selected_paths, (GFunc) gtk_tree_path_free, NULL);
+  g_list_free (selected_paths);
+
+/* Remove items from references */
+  while (selected_refs)
+    {
+      path = gtk_tree_row_reference_get_path (selected_refs->data);
+      gtk_tree_model_get_iter (GTK_TREE_MODEL (filelist_store), &iter, path);
+      gtk_list_store_remove (filelist_store, &iter);
+      gtk_tree_path_free (path);
+      selected_refs = g_list_next (selected_refs);
+    }
+  g_list_foreach (selected_paths, (GFunc) gtk_tree_row_reference_free, NULL);
+  g_list_free (selected_paths);
+}
+
+/**
+ * @brief Select all the entries of the list view
+ */
+void
+select_all_files (gpointer user_data)
+{
+  GtkWidget *filelist = glade_xml_get_widget (musicinsertXML, "filelist");
+  GtkTreeSelection *selection =
+    gtk_tree_view_get_selection (GTK_TREE_VIEW (filelist));
+  gtk_tree_selection_select_all (selection);
+}

Added: gnunet-gtk/src/fs/extensions/musicinsert.glade
===================================================================
--- gnunet-gtk/src/fs/extensions/musicinsert.glade      2005-06-28 20:11:49 UTC 
(rev 1117)
+++ gnunet-gtk/src/fs/extensions/musicinsert.glade      2005-06-28 20:16:36 UTC 
(rev 1118)
@@ -0,0 +1,760 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
+
+<glade-interface>
+
+<widget class="GtkWindow" id="musicinsertdialog">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Insert an album into GNUnet 
AFS</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <signal name="destroy" handler="on_musicinsertdialog_destroy" 
last_modification_time="Sat, 06 Nov 2004 17:51:42 GMT"/>
+
+  <child>
+    <widget class="GtkVBox" id="vbox">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child>
+       <widget class="GtkTable" id="globaltable">
+         <property name="border_width">14</property>
+         <property name="visible">True</property>
+         <property name="n_rows">7</property>
+         <property name="n_columns">4</property>
+         <property name="homogeneous">False</property>
+         <property name="row_spacing">16</property>
+         <property name="column_spacing">24</property>
+
+         <child>
+           <widget class="GtkLabel" id="keywordslabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Additional _keywords 
:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="mnemonic_widget">keywordsentry</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">4</property>
+             <property name="bottom_attach">5</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkEntry" id="keywordsentry">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">Add here your misc 
keywords, comma-separated.</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes">music</property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char">*</property>
+             <property name="activates_default">False</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">3</property>
+             <property name="top_attach">4</property>
+             <property name="bottom_attach">5</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkToggleButton" id="keywordstogglebutton">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">Use these keywords 
for all files in the album. When pressed, this overpass the file-by-file 
keywords.</property>
+             <property name="can_focus">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="active">True</property>
+             <property name="inconsistent">False</property>
+             <signal name="toggled" handler="on_keywordstogglebutton_toggled" 
last_modification_time="Sat, 26 Feb 2005 19:56:04 GMT"/>
+
+             <child>
+               <widget class="GtkImage" id="image12">
+                 <property name="visible">True</property>
+                 <property name="stock">gtk-dnd-multiple</property>
+                 <property name="icon_size">4</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="left_attach">3</property>
+             <property name="right_attach">4</property>
+             <property name="top_attach">4</property>
+             <property name="bottom_attach">5</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="typelabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">_Type :</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">3</property>
+             <property name="bottom_attach">4</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="fileslinklabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">_Insert these files 
:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="mnemonic_widget">linkalbumradio</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkRadioButton" id="linkalbumradio">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">Create a GNUnet 
directory to be able to find and download all the files together.</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">As an al_bum</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="active">False</property>
+             <property name="inconsistent">False</property>
+             <property name="draw_indicator">True</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">2</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkRadioButton" id="linkseparateradio">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">Don't create any link 
between these files. They won't be found together.</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">_Separately</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="active">False</property>
+             <property name="inconsistent">False</property>
+             <property name="draw_indicator">True</property>
+             <property name="group">linkalbumradio</property>
+           </widget>
+           <packing>
+             <property name="left_attach">2</property>
+             <property name="right_attach">3</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="insertlabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Insertion method 
:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="mnemonic_widget">radioinsert</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">6</property>
+             <property name="bottom_attach">7</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkHBox" id="hbox4">
+             <property name="visible">True</property>
+             <property name="homogeneous">True</property>
+             <property name="spacing">0</property>
+
+             <child>
+               <widget class="GtkRadioButton" id="radioinsert">
+                 <property name="visible">True</property>
+                 <property name="tooltip" translatable="yes">Encrypt the files 
into GNUnet database. You won't be able to remove the files in the 
future.</property>
+                 <property name="can_focus">True</property>
+                 <property name="label" translatable="yes">Full 
_insertion</property>
+                 <property name="use_underline">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                 <property name="focus_on_click">True</property>
+                 <property name="active">False</property>
+                 <property name="inconsistent">False</property>
+                 <property name="draw_indicator">True</property>
+                 <signal name="toggled" handler="on_radioinsert_toggled" 
last_modification_time="Fri, 25 Feb 2005 20:58:38 GMT"/>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkRadioButton" id="radioindex">
+                 <property name="visible">True</property>
+                 <property name="tooltip" translatable="yes">You should choose 
this option if you want to save disk space or remove the file from AFS later. 
But you mustn't move an indexed file before it has been removed from 
GNUnet.</property>
+                 <property name="can_focus">True</property>
+                 <property name="label" translatable="yes">Index 
_only</property>
+                 <property name="use_underline">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                 <property name="focus_on_click">True</property>
+                 <property name="active">True</property>
+                 <property name="inconsistent">False</property>
+                 <property name="draw_indicator">True</property>
+                 <property name="group">radioinsert</property>
+                 <signal name="toggled" handler="on_radioindex_toggled" 
last_modification_time="Fri, 25 Feb 2005 20:59:18 GMT"/>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkCheckButton" id="copyfilesbutton">
+                 <property name="visible">True</property>
+                 <property name="tooltip" translatable="yes">Copy files to 
shared folder to allow you to move them after indexation. You need free disk 
space to do this.</property>
+                 <property name="can_focus">True</property>
+                 <property name="label" translatable="yes">Co_py 
files</property>
+                 <property name="use_underline">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                 <property name="focus_on_click">True</property>
+                 <property name="active">False</property>
+                 <property name="inconsistent">False</property>
+                 <property name="draw_indicator">True</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">3</property>
+             <property name="top_attach">6</property>
+             <property name="bottom_attach">7</property>
+             <property name="x_options">fill</property>
+             <property name="y_options">fill</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="commentslabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Additional _comments 
:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="mnemonic_widget">commentsentry</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">5</property>
+             <property name="bottom_attach">6</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkEntry" id="commentsentry">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">Add here your misc 
comments.</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes"></property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char">*</property>
+             <property name="activates_default">False</property>
+           </widget>
+           <packing>
+             <property name="left_attach">1</property>
+             <property name="right_attach">3</property>
+             <property name="top_attach">5</property>
+             <property name="bottom_attach">6</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkToggleButton" id="commentstogglebutton">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">Use these comments 
for all files in the album, and not only for the album.</property>
+             <property name="can_focus">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="active">False</property>
+             <property name="inconsistent">False</property>
+
+             <child>
+               <widget class="GtkImage" id="image13">
+                 <property name="visible">True</property>
+                 <property name="stock">gtk-dnd-multiple</property>
+                 <property name="icon_size">4</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="left_attach">3</property>
+             <property name="right_attach">4</property>
+             <property name="top_attach">5</property>
+             <property name="bottom_attach">6</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="albumlabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Alb_um name :</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">2</property>
+             <property name="bottom_attach">3</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="artistlabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">_Artist :</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">1</property>
+             <property name="bottom_attach">2</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkToggleButton" id="albumtogglebutton">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">All the files listed 
below are part of the same album. When pressed, this overpass the file-by-file 
album name.</property>
+             <property name="can_focus">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="active">True</property>
+             <property name="inconsistent">False</property>
+             <signal name="toggled" handler="on_albumtogglebutton_toggled" 
last_modification_time="Sat, 26 Feb 2005 19:55:05 GMT"/>
+
+             <child>
+               <widget class="GtkImage" id="image9">
+                 <property name="visible">True</property>
+                 <property name="stock">gtk-dnd-multiple</property>
+                 <property name="icon_size">4</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="left_attach">3</property>
+             <property name="right_attach">4</property>
+             <property name="top_attach">2</property>
+             <property name="bottom_attach">3</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkToggleButton" id="artisttogglebutton">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">All the files are by 
the same artist. When pressed, this overpass the file-by-file artist 
name.</property>
+             <property name="can_focus">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="active">True</property>
+             <property name="inconsistent">False</property>
+             <signal name="toggled" handler="on_artisttogglebutton_toggled" 
last_modification_time="Sat, 26 Feb 2005 19:55:24 GMT"/>
+
+             <child>
+               <widget class="GtkImage" id="image10">
+                 <property name="visible">True</property>
+                 <property name="stock">gtk-dnd-multiple</property>
+                 <property name="icon_size">4</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="left_attach">3</property>
+             <property name="right_attach">4</property>
+             <property name="top_attach">1</property>
+             <property name="bottom_attach">2</property>
+             <property name="x_options">fill</property>
+             <property name="y_options"></property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkScrolledWindow" id="scrolledwindow">
+         <property name="visible">True</property>
+         <property name="can_focus">True</property>
+         <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+         <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+         <property name="shadow_type">GTK_SHADOW_IN</property>
+         <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+         <child>
+           <widget class="GtkTreeView" id="filelist">
+             <property name="height_request">167</property>
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">The files you are 
going to insert. Edit the entries if they aren't correctly filled.</property>
+             <property name="can_focus">True</property>
+             <property name="headers_visible">True</property>
+             <property name="rules_hint">True</property>
+             <property name="reorderable">False</property>
+             <property name="enable_search">True</property>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox1">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkHButtonBox" id="hbuttonbox1">
+             <property name="border_width">4</property>
+             <property name="visible">True</property>
+             <property name="layout_style">GTK_BUTTONBOX_START</property>
+             <property name="spacing">16</property>
+
+             <child>
+               <widget class="GtkButton" id="fileaddbutton">
+                 <property name="visible">True</property>
+                 <property name="can_default">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                 <property name="focus_on_click">True</property>
+                 <signal name="clicked" handler="on_fileaddbutton_clicked" 
last_modification_time="Tue, 08 Feb 2005 17:41:33 GMT"/>
+
+                 <child>
+                   <widget class="GtkAlignment" id="alignment1">
+                     <property name="visible">True</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xscale">0</property>
+                     <property name="yscale">0</property>
+                     <property name="top_padding">0</property>
+                     <property name="bottom_padding">0</property>
+                     <property name="left_padding">0</property>
+                     <property name="right_padding">0</property>
+
+                     <child>
+                       <widget class="GtkHBox" id="hbox2">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">2</property>
+
+                         <child>
+                           <widget class="GtkImage" id="image1">
+                             <property name="visible">True</property>
+                             <property name="stock">gtk-file</property>
+                             <property name="icon_size">4</property>
+                             <property name="xalign">0.5</property>
+                             <property name="yalign">0.5</property>
+                             <property name="xpad">0</property>
+                             <property name="ypad">0</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkLabel" id="fileaddbuttonlabel">
+                             <property name="visible">True</property>
+                             <property name="label" translatable="yes">Add 
_files</property>
+                             <property name="use_underline">True</property>
+                             <property name="use_markup">False</property>
+                             <property 
name="justify">GTK_JUSTIFY_LEFT</property>
+                             <property name="wrap">False</property>
+                             <property name="selectable">False</property>
+                             <property name="xalign">0.5</property>
+                             <property name="yalign">0.460000008345</property>
+                             <property name="xpad">0</property>
+                             <property name="ypad">0</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkButton" id="diraddbutton">
+                 <property name="visible">True</property>
+                 <property name="can_default">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                 <property name="focus_on_click">True</property>
+                 <signal name="clicked" handler="on_diraddbutton_clicked" 
last_modification_time="Tue, 08 Feb 2005 17:41:51 GMT"/>
+
+                 <child>
+                   <widget class="GtkAlignment" id="alignment2">
+                     <property name="visible">True</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xscale">0</property>
+                     <property name="yscale">0</property>
+                     <property name="top_padding">0</property>
+                     <property name="bottom_padding">0</property>
+                     <property name="left_padding">0</property>
+                     <property name="right_padding">0</property>
+
+                     <child>
+                       <widget class="GtkHBox" id="hbox3">
+                         <property name="visible">True</property>
+                         <property name="homogeneous">False</property>
+                         <property name="spacing">2</property>
+
+                         <child>
+                           <widget class="GtkImage" id="image2">
+                             <property name="visible">True</property>
+                             <property name="stock">gtk-directory</property>
+                             <property name="icon_size">4</property>
+                             <property name="xalign">0.5</property>
+                             <property name="yalign">0.5</property>
+                             <property name="xpad">0</property>
+                             <property name="ypad">0</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+
+                         <child>
+                           <widget class="GtkLabel" id="diraddbuttonlabel">
+                             <property name="visible">True</property>
+                             <property name="label">Add a _directory</property>
+                             <property name="use_underline">True</property>
+                             <property name="use_markup">False</property>
+                             <property 
name="justify">GTK_JUSTIFY_LEFT</property>
+                             <property name="wrap">False</property>
+                             <property name="selectable">False</property>
+                             <property name="xalign">0.5</property>
+                             <property name="yalign">0.5</property>
+                             <property name="xpad">0</property>
+                             <property name="ypad">0</property>
+                           </widget>
+                           <packing>
+                             <property name="padding">0</property>
+                             <property name="expand">False</property>
+                             <property name="fill">False</property>
+                           </packing>
+                         </child>
+                       </widget>
+                     </child>
+                   </widget>
+                 </child>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkHButtonBox" id="hbuttonbox">
+             <property name="border_width">4</property>
+             <property name="visible">True</property>
+             <property name="layout_style">GTK_BUTTONBOX_END</property>
+             <property name="spacing">15</property>
+
+             <child>
+               <widget class="GtkButton" id="cancelbutton">
+                 <property name="visible">True</property>
+                 <property name="tooltip" translatable="yes">Quit this window 
without inserting the files. All keywords data will be lost.</property>
+                 <property name="can_default">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="label">gtk-cancel</property>
+                 <property name="use_stock">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                 <property name="focus_on_click">True</property>
+                 <signal name="clicked" handler="on_cancelbutton_clicked" 
last_modification_time="Sat, 06 Nov 2004 17:49:25 GMT"/>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkButton" id="okbutton">
+                 <property name="visible">True</property>
+                 <property name="tooltip" translatable="yes">Insert files into 
GNUnet AFS now.</property>
+                 <property name="can_default">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="label">gtk-ok</property>
+                 <property name="use_stock">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+                 <property name="focus_on_click">True</property>
+                 <signal name="clicked" handler="on_okbutton_clicked" 
last_modification_time="Sat, 06 Nov 2004 17:49:08 GMT"/>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>

Added: gnunet-gtk/src/fs/extensions/musicinsert.h
===================================================================
--- gnunet-gtk/src/fs/extensions/musicinsert.h  2005-06-28 20:11:49 UTC (rev 
1117)
+++ gnunet-gtk/src/fs/extensions/musicinsert.h  2005-06-28 20:16:36 UTC (rev 
1118)
@@ -0,0 +1,142 @@
+/*
+     This file is part of GNUnet.
+     (C) 2005 Christian Grothoff (and other contributing authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/musicinsert.h
+ * @brief Music insertion dialog for gnunet-gtk
+ * @author Milan Bouchet
+ */
+
+#ifndef MUSICINSERT_MAIN_H
+#define MUSICINSERT_MAIN_H
+
+#include <extractor.h>
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+/* platform.h will be needed */
+       
+
+GladeXML *musicinsertXML;
+GtkListStore *filelist_store;
+GList *AlbumList, *ArtistList, *TypeList;
+GtkComboBoxEntry *artistcombobox, *albumcombobox, *typecombobox;
+EXTRACTOR_ExtractorList *Extractors;
+
+GtkTreeViewColumn *filename_list_col, *title_list_col, *artist_list_col,
+  *album_list_col, *type_list_col, *format_list_col, *keywords_list_col;
+
+GtkWidget *filelist_popup;
+
+/* Know music files mimetypes to list in the format ComboBoxEntry */
+enum Types
+{
+  FORMAT_OGG = 0,
+  FORMAT_MP3,
+  FORMAT_MPC,
+  FORMAT_AAC,
+  FORMAT_WMA,
+  FORMAT_FLAC,
+  FORMAT_APE,
+  FORMAT_WAV,
+  FORMAT_MIDI,
+  FORMAT_REAL
+};
+
+/* Columns IDs constants */
+enum
+{
+  REAL_FILENAME_COL = 0,
+  FILENAME_COL,
+  TITLE_COL,
+  ARTIST_COL,
+  ALBUM_COL,
+  TYPE_COL,
+  FORMAT_COL,
+  KEYWORDS_COL,
+  COLS_NUMBER
+};
+
+/* Columns IDs  : need to be stored in a variable to be passed using a (void 
*) */
+const gint filename_col_num = FILENAME_COL;
+const gint title_col_num = TITLE_COL;
+const gint artist_col_num = ARTIST_COL;
+const gint album_col_num = ALBUM_COL;
+const gint type_col_num = TYPE_COL;
+const gint format_col_num = FORMAT_COL;
+const gint keywords_col_num = KEYWORDS_COL;
+
+/* Temp definitions to remove, will be present in platform.h from GNUnet 
source*/
+ #define DIR_SEPARATOR '/'
+ #define ACCESS(p, m) access(p, m)
+ #define STRDUP(s) strdup (s)
+
+
+EXTRACTOR_KeywordList *get_EXTRACTORKeywords (const EXTRACTOR_ExtractorList *
+                                             exList, const gchar * filename);
+void set_File_Keywords (const gchar * filename);
+void activateComboBoxes ();
+void updateColumns ();
+void show_musicinsertdialog ();
+
+/* Callback functions declaration */
+void on_musicinsertdialog_destroy (GtkObject * object, gpointer user_data);
+
+void on_cancelbutton_clicked (GtkButton * button, gpointer user_data);
+
+void on_okbutton_clicked (GtkButton * button, gpointer user_data);
+
+void on_fileaddbutton_clicked (GtkButton * button, gpointer user_data);
+
+void on_diraddbutton_clicked (GtkButton * button, gpointer user_data);
+
+void
+on_radioinsert_toggled (GtkRadioButton * radiobutton, gpointer user_data);
+
+void on_radioindex_toggled (GtkRadioButton * radiobutton, gpointer user_data);
+
+void
+on_albumtogglebutton_toggled (GtkToggleButton * togglebutton,
+                             gpointer user_data);
+
+void
+on_artisttogglebutton_toggled (GtkToggleButton * togglebutton,
+                              gpointer user_data);
+
+void
+on_typetogglebutton_toggled (GtkToggleButton * togglebutton,
+                            gpointer user_data);
+
+void
+on_keywordstogglebutton_toggled (GtkToggleButton * togglebutton,
+                                gpointer user_data);
+
+void
+on_renderer_edited (GtkCellRendererText * cellrenderertext,
+                   gchar * arg1, gchar * arg2, gpointer user_data);
+
+gboolean popup_delete (GtkWidget * widget,
+                      GdkEventButton * event, gpointer user_data);
+
+void remove_file_from_list (gpointer user_data);
+
+void select_all_files (gpointer user_data);
+
+
+#endif





reply via email to

[Prev in Thread] Current Thread [Next in Thread]