Example #1
0
static void
update_image_preview (GtkFileChooser *chooser)
{
	GtkWidget *image;
	gchar *file;

	image = gtk_file_chooser_get_preview_widget (GTK_FILE_CHOOSER (chooser));
	file = gtk_file_chooser_get_preview_uri (chooser);

	if (file != NULL)
	{

		GdkPixbuf *pixbuf = NULL;

		pixbuf = create_preview_pixbuf (file);
		g_free (file);

		if (pixbuf != NULL)
		{
			gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
			g_object_unref (pixbuf);
		}
		else
		{
			gtk_image_set_from_stock (GTK_IMAGE (image),
			                          "gtk-dialog-question",
			                          GTK_ICON_SIZE_DIALOG);
		}
	}
	gtk_file_chooser_set_preview_widget_active (chooser, file != NULL);
}
Example #2
0
JNIEXPORT jstring JNICALL
Java_org_gnome_gtk_GtkFileChooser_gtk_1file_1chooser_1get_1preview_1uri
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	char* result;
	jstring _result;
	GtkFileChooser* self;

	// convert parameter self
	self = (GtkFileChooser*) _self;

	// call function
	result = gtk_file_chooser_get_preview_uri(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jstring) bindings_java_newString(env, result);

	// cleanup return value
	if (result != NULL) {
		g_free(result);
	}

	// and finally
	return _result;
}
Example #3
0
static void
gimp_file_dialog_update_preview (GtkFileChooser *chooser,
                                 GimpFileDialog *dialog)
{
  gimp_thumb_box_take_uri (GIMP_THUMB_BOX (dialog->thumb_box),
                           gtk_file_chooser_get_preview_uri (chooser));
}
static void
update_preview (GtkFileChooser               *chooser,
                GnomeDesktopThumbnailFactory *thumb_factory)
{
        gchar *uri;

        uri = gtk_file_chooser_get_preview_uri (chooser);

        if (uri) {
                GdkPixbuf *pixbuf = NULL;
                const gchar *mime_type = NULL;
                GFile *file;
                GFileInfo *file_info;
                GtkWidget *preview;

                preview = gtk_file_chooser_get_preview_widget (chooser);

                file = g_file_new_for_uri (uri);
                file_info = g_file_query_info (file,
                                               G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
                                               G_FILE_QUERY_INFO_NONE,
                                               NULL, NULL);
                g_object_unref (file);

                if (file_info != NULL) {
                        mime_type = g_file_info_get_content_type (file_info);
                        g_object_unref (file_info);
                }

                if (mime_type) {
                        pixbuf = gnome_desktop_thumbnail_factory_generate_thumbnail (thumb_factory,
                                                                                     uri,
                                                                                     mime_type);
                }

                gtk_dialog_set_response_sensitive (GTK_DIALOG (chooser),
                                                   GTK_RESPONSE_ACCEPT,
                                                   (pixbuf != NULL));

                if (pixbuf != NULL) {
                        gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf);
                        g_object_unref (pixbuf);
                }
                else {
                        gtk_image_set_from_stock (GTK_IMAGE (preview),
                                                  GTK_STOCK_DIALOG_QUESTION,
                                                  GTK_ICON_SIZE_DIALOG);
                }

                g_free (uri);
        }

        gtk_file_chooser_set_preview_widget_active (chooser, TRUE);
}
Example #5
0
int
clip_GTK_FILECHOOSERGETPREVIEWURI(ClipMachine * ClipMachineMemory)
{
   C_object *cchooser = _fetch_co_arg(ClipMachineMemory);

   CHECKCOBJ(cchooser, GTK_IS_FILE_CHOOSER(cchooser->object));

   _clip_retc(ClipMachineMemory, gtk_file_chooser_get_preview_uri(GTK_FILE_CHOOSER(cchooser->object)));

   return 0;
 err:
   return 1;
}
Example #6
0
static void
chooser_update_preview_cb (GtkFileChooser *chooser,
			   gpointer        user_data)
{
  gchar *filename;

  filename = gtk_file_chooser_get_preview_uri (chooser);
  if (filename != NULL)
    {
      g_message ("%s::update-preview\n\tPreview Filename: `%s'\nDone.\n",
		 G_OBJECT_TYPE_NAME (chooser), filename);
      g_free (filename);
    }
}
static void
wp_update_preview (GtkFileChooser *chooser,
                   AppearanceData *data)
{
  gchar *uri;

  uri = gtk_file_chooser_get_preview_uri (chooser);

  if (uri)
  {
    GdkPixbuf *pixbuf = NULL;
    const gchar *mime_type = NULL;
    GFile *file;
    GFileInfo *file_info;

    file = g_file_new_for_uri (uri);
    file_info = g_file_query_info (file,
                                   G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
                                   G_FILE_QUERY_INFO_NONE,
                                   NULL, NULL);
    g_object_unref (file);

    if (file_info != NULL)
    {
      mime_type = g_file_info_get_content_type (file_info);
      g_object_unref (file_info);
    }

    if (mime_type)
    {
      pixbuf = mate_desktop_thumbnail_factory_generate_thumbnail (data->thumb_factory,
								   uri,
								   mime_type);
    }

    if (pixbuf != NULL)
    {
      gtk_image_set_from_pixbuf (GTK_IMAGE (data->wp_image), pixbuf);
      g_object_unref (pixbuf);
    }
    else
    {
      gtk_image_set_from_stock (GTK_IMAGE (data->wp_image),
                                "gtk-dialog-question",
                                GTK_ICON_SIZE_DIALOG);
    }
  }

  gtk_file_chooser_set_preview_widget_active (chooser, TRUE);
}
Example #8
0
static void
update_preview (GtkFileChooser      *chooser,
                ExoThumbnailPreview *thumbnail_preview)
{
    gchar *uri;

    _exo_return_if_fail (EXO_IS_THUMBNAIL_PREVIEW (thumbnail_preview));
    _exo_return_if_fail (GTK_IS_FILE_CHOOSER (chooser));

    /* update the URI for the preview */
    uri = gtk_file_chooser_get_preview_uri (chooser);
    if (G_UNLIKELY (uri == NULL))
    {
        /* gee, why is there a get_preview_uri() method if
       * it doesn't work in several cases? did anybody ever
       * test this method prior to committing it?
       */
        uri = gtk_file_chooser_get_uri (chooser);
    }
    _exo_thumbnail_preview_set_uri (thumbnail_preview, uri);
    g_free (uri);
}
Php::Value GtkFileChooserDialog_::get_preview_uri()
{
	std::string ret = gtk_file_chooser_get_preview_uri (GTK_FILE_CHOOSER(instance));

	return ret;
}