Exemple #1
0
        static void gtml_reload()
        {
            GLib.IFile   applications = GLib.FileFactory.NewForPath("./gtml");
            GLib.KeyFile programs     = new GLib.KeyFile();
            bool         load         = false;

            if (GLib.FileFactory.NewForPath("./data").Exists)
            {
                if (GLib.FileFactory.NewForPath("./data/programs.gkf").Exists)
                {
                    load = programs.LoadFromFile("./data/programs.gkf", gkfflags);
                }
            }
            else
            {
                GLib.FileFactory.NewForPath("./data").MakeDirectoryWithParents(null);
            }
            if (load == true)
            {
                if (programs.HasGroup("Programs"))
                {
                    string[] names = programs.GetKeys("Programs");
                    int      x     = 0;
                    while (names[x].Equals("") != true || names[x] != null)
                    {
                        string location = programs.GetString("Programs", names[x]);
                        create_stacks(names[x], location);
                        location = null;
                        x++;
                        break;
                    }
                }
                else
                {
                    System.Console.WriteLine("No linked programs in data.");
                }
            }
            else
            {
                System.Console.WriteLine("No linked programs\n");
            }

            GLib.FileEnumerator apps = applications.EnumerateChildren("*", feflags, null);
            while (true)
            {
                GLib.FileInfo info = apps.NextFile();
                if (info == null)
                {
                    apps.Dispose();
                    break;
                }
                else
                {
                    GLib.IFile outf = applications.GetChildForDisplayName(info.DisplayName);
                    string     name = info.DisplayName;
                    if ((name.Equals(".") && name.Equals("..")) == false && (name.Length != 0 || name != null))
                    {
                        string path = outf.Path;
                        if (info.FileType == GLib.FileType.Directory)
                        {
                            create_stacks(name, path);

                            /*
                             * if (!gtk_stack_get_child_by_name (GTK_STACK(stack),path)) {
                             *      create_stacks (name,path);
                             * }
                             *
                             *
                             *
                             *
                             */
                        }
                    }
                }
            }

            if (stack.CurrentPageWidget == null)
            {
                ;                                             //gtml_import_full ();
            }
        }
Exemple #2
0
        static void start_import(Gtk.FileChooserButton widget)
        {
            string type = widget.Title;
            string path = widget.Filename;

            GLib.IFile   old      = GLib.FileFactory.NewForPath(path);
            GLib.IFile   news     = GLib.FileFactory.NewForPath("./gtml" + old.Basename);
            GLib.KeyFile programs = new GLib.KeyFile();
            if (GLib.FileFactory.NewForPath("./data/programs.gkf").Exists)
            {
                programs.LoadFromFile("./data/programs.gkf", gkfflags);
            }
            if (type.Equals("Full"))
            {
                old.Move(news, fcflags, null, null);
                GLib.FileFactory.NewForPath(news.Path + "/profile").MakeDirectoryWithParents(null);
                create_stacks(news.Basename, news.Path);
            }
            else if (type.Equals("Partial"))
            {
                /*
                 * g_file_copy (old, new,cflags,NULL,NULL,NULL,NULL);
                 * GFileEnumerator *ennew = g_file_enumerate_children (old,"*",G_FILE_QUERY_INFO_NONE,NULL,NULL);
                 * while (TRUE) {
                 *      GFile *out;
                 *      GFileInfo *info;
                 *      if (!g_file_enumerator_iterate(ennew,&info,&out,NULL,NULL)) {
                 *              g_object_unref(ennew);
                 *              break;
                 *      } else {
                 *              if (!info) break;
                 *              gchar *name = g_file_info_get_attribute_as_string (info,G_FILE_ATTRIBUTE_STANDARD_NAME);
                 *              if ((g_strcmp0(name,".") && g_strcmp0(name,"..")) && name[0] != '.')	{
                 *                      gchar *path = g_file_get_path (out);
                 *                      GString *n = g_string_new (name);
                 *                      if (g_file_test(path,G_FILE_TEST_IS_DIR)){
                 *
                 *                              if (!gtk_stack_get_child_by_name (GTK_STACK(stack),n->str)) {
                 *                                      g_print("%s\n",n->str);
                 *                                      //gtk_stack_add_titled (GTK_STACK(stack),create_tabs(),n->str,n->str);
                 *                              }
                 *                                              //gtk_stack_set_visible_child_name (GTK_STACK(stack),n->str);
                 *                      }
                 *              }
                 *      }
                 *      if (!info) break;
                 * }
                 * g_file_make_directory_with_parents (g_file_new_for_path(g_strdup_printf("%s/profile",g_file_get_path(new))),NULL,NULL);
                 */
            }
            else if (type.Equals("Link"))
            {
                programs.SetString("Programs", old.Basename, old.Path);
                GLib.FileFactory.NewForPath(news.Path + "/profile").MakeDirectoryWithParents(null);
                create_stacks(old.Basename, old.Path);
            }

            programs.Save("./data/programs.gkf");

            /*
             * GNotification *inotification = g_notification_new ("Import Complete");
             * g_notification_set_priority (inotification,G_NOTIFICATION_PRIORITY_NORMAL);
             *      ... Data was here ...
             * g_notification_set_body (inotification,g_strdup_printf ("The %s import of the file located at %s is now complete.\nReturn to Mozilla Launcher to secure and launch it.", type,path));
             * g_application_send_notification (G_APPLICATION(app),"import-complete",inotification);
             */
        }
            public GMpiFileInfo(string mediaPlayerId)
            {
                try {
                    mpi_file = new KeyFile ();
                    mpi_file.SetListSeparator (Separator);
                    string full_path;
                    mpi_file.LoadFromDirs (String.Format ("{0}.mpi", mediaPlayerId),
                                           new string [] {"/usr/share/media-player-info",
                                                          "/usr/local/share/media-player-info"},
                                           out full_path, KeyFileFlags.None);
                } catch (GLib.GException) {
                    Hyena.Log.WarningFormat ("Failed to load media-player-info file for {0}",
                                             mediaPlayerId);
                }

                LoadProperties ();
            }