Ejemplo n.º 1
0
static void
startup_slideshow (FilesLoader *files)
{
   GimvSlideshow *slideshow;
   GList *list, *filelist;

   /* get file list from directories */
   if (args_val.read_dir) {
      GList *tmplist = g_list_copy (files->dirlist);
      gint flags = 0;

      if (!args_val.ignore_ext)
         flags = flags | GETDIR_DETECT_EXT;
      if (args_val.read_dot)
         flags = flags | GETDIR_READ_DOT;
      if (args_val.read_dir_recursive) {
         flags = flags | GETDIR_RECURSIVE;
         if (conf.recursive_follow_link)
            flags = flags | GETDIR_FOLLOW_SYMLINK;
      }
      if (conf.disp_filename_stdout)
         flags = flags | GETDIR_DISP_STDOUT;

      for (list = tmplist; list; list = g_list_next (list)) {
         gchar *dirname = list->data;
         GList *filelist = NULL, *dirlist = NULL;
         if (dirname && *dirname) {
            get_dir (dirname, flags, &filelist, &dirlist);
            files->filelist = g_list_concat (files->filelist, filelist);
            files->dirlist = g_list_concat (files->dirlist, dirlist);
         }
      }
      g_list_free (tmplist);
   }

   filelist = NULL;
   for (list = files->filelist; list; list = g_list_next (list)) {
      GimvImageInfo *info = gimv_image_info_get (list->data);

      if (info)
         filelist = g_list_append (filelist, info);
   }

   /* init slideshow */
   slideshow = gimv_slideshow_new_with_filelist (filelist, filelist);
   gimv_slideshow_set_interval (slideshow, args_val.slideshow_interval * 1000);
   /* files->filelist = NULL; */

   /*
   if (g_list_length (slideshow->filelist) < 1)
   arg_help (argv, stderr);
   */

   gtk_init_add (idle_slideshow_startup, slideshow);

   files_loader_delete (files);
}
Ejemplo n.º 2
0
static VALUE
rg_m_init_add(VALUE self)
{
    volatile VALUE func = rb_block_proc();

    gtk_init_add((GtkFunction)gtk_m_function2, (gpointer)func);
    G_RELATIVE(self, func);
    return Qnil;
}
Ejemplo n.º 3
0
/******************************************************************************
 *
 *   main
 *
 ******************************************************************************/
gint
main (gint argc, gchar *argv[])
{
   GimvThumbWin *tw = NULL;
   gint remaining;
   gboolean open_thumbwin = FALSE;
   FilesLoader *files = NULL;

   gimageview_init (&argc, argv);

   if (argc == 1) {
      open_thumbwin = TRUE;
   }

   /* override config by argument while start up*/
   arg_parse (argc, argv, &remaining);

#ifdef ENABLE_SPLASH
   show_splash ();
#endif

   /* open window if specified by config or argument */
   if (args_val.open_thumbwin || open_thumbwin) {
      tw = gimv_thumb_win_open_window ();
   }
   if (args_val.open_imagewin) {
      gimv_image_win_open_window (NULL);
   }

   /* set FilesLoader struct data for opening files */
   files = get_files_from_argument (argc, argv, remaining);
   if (!files && !gimv_thumb_win_get_list() && !gimv_image_win_get_list()) {
      exit (1);
   } else if (tw && files && files->dirlist) {
      GList *list = g_list_last (files->dirlist);
      gchar *dirname = NULL;

      if (list) dirname = list->data;
      if (dirname) gimv_dir_view_chroot (tw->dv, dirname);
   }

   /* exec slide show if specified by argument */
   if (args_val.exec_slideshow) {
      startup_slideshow (files);

   /* check filelist & dirlist and open image files */
   } else {
      gtk_init_add (idle_open_image_startup, files);
   }

   /* main roop */
   gtk_main ();

   return 0;
}
Ejemplo n.º 4
0
static void encoding_dialog(const gchar *path)
{
	static gint warned_user = FALSE;
	GenericDialog *gd;
	GString *string;
	const gchar *lc;
	const gchar *bf;

	/* check that gtk is initialized (loop is level > 0) */
	if (gtk_main_level() == 0)
		{
		/* gtk not initialized */
		gtk_init_add(encoding_dialog_delay, g_strdup(path));
		return;
		}

	if (warned_user) return;
	warned_user = TRUE;

	lc = getenv("LANG");
	bf = getenv("G_BROKEN_FILENAMES");
	warned_user = TRUE;

	string = g_string_new("");
	g_string_append(string, "One or more filenames are not encoded with the preferred locale character set.\n");
	g_string_append_printf(string, "Operations on, and display of these files with %s may not succeed.\n\n", PACKAGE);
	g_string_append(string, "If your filenames are not encoded in utf-8, try setting\n");
	g_string_append(string, "the environment variable G_BROKEN_FILENAMES=1\n");
	g_string_append_printf(string, "It appears G_BROKEN_FILENAMES is %s%s\n\n",
				(bf) ? "set to " : "not set.", (bf) ? bf : "");
	g_string_append_printf(string, "The locale appears to be set to \"%s\"\n(set by the LANG environment variable)\n", (lc) ? lc : "undefined");
	if (lc && (strstr(lc, "UTF-8") || strstr(lc, "utf-8")))
		{
		gchar *name;
		name = g_convert(path, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
		string = g_string_append(string, "\nPreferred encoding appears to be UTF-8, however the file:\n");
		g_string_append_printf(string, "\"%s\"\n%s encoded in valid UTF-8.\n",
				(name) ? name : "[name not displayable]",
				(g_utf8_validate(path, -1, NULL)) ? "is": "is NOT");
		g_free(name);
		}

	gd = generic_dialog_new("Filename encoding locale mismatch",
				PACKAGE, "locale warning", NULL, TRUE, NULL, NULL);
	generic_dialog_add_button(gd, GTK_STOCK_CLOSE, NULL, NULL, TRUE);

	generic_dialog_add_message(gd, GTK_STOCK_DIALOG_WARNING,
				   "Filename encoding locale mismatch", string->str);

	gtk_widget_show(gd->dialog);

	g_string_free(string, TRUE);
}
Ejemplo n.º 5
0
/* Register a function to be called when the mainloop is started. */
int
clip_GTK_INITADD(ClipMachine * cm)
{
	C_var *c;

	CHECKARG2(1,PCODE_t,CCODE_t);

	c = NEW(C_var);
	c->cm = cm; //c->cfunc = NEW(ClipVar);
	_clip_mclone(cm,&c->cfunc, _clip_spar(cm,1));
	gtk_init_add((GtkFunction)__func,c);
	return 0;
err:
	return 1;
}
Ejemplo n.º 6
0
void alarm_init (void)
{
    debug_printf (DEBUG_INFO, "* Alarm plugin initialized");

	bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");

    timer = g_timer_new ();

    /* Timer starts on creation, stop it! */
    timer_on = FALSE;
    g_timer_stop (timer);
    g_timer_reset (timer);

    gtk_init_add((GtkFunction)alarm_init_delayed, NULL);
}
Ejemplo n.º 7
0
static void startGTK(GtkWidget *dialog){
	gtk_init_add( (GSourceFunc) closeGTK, NULL );
	gtk_quit_add_destroy(1,GTK_OBJECT(dialog));
	//g_timeout_add(10, (GSourceFunc) destroyWidgetGTK, (gpointer) dialog);
	gtk_main();
}