mirror of https://github.com/GNOME/gimp.git
app: add gimp_mount_enclosing_volume(), using the the GimpGui vtable
and implement it in gui-vtable.c using gtk_mount_operation_new().
This commit is contained in:
parent
a4b807905c
commit
5c1f14be67
|
@ -64,6 +64,7 @@ gimp_gui_init (Gimp *gimp)
|
|||
gimp->gui.pdb_dialog_close = NULL;
|
||||
gimp->gui.recent_list_add_file = NULL;
|
||||
gimp->gui.recent_list_load = NULL;
|
||||
gimp->gui.mount_enclosing_volume = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -492,3 +493,20 @@ gimp_recent_list_load (Gimp *gimp)
|
|||
if (gimp->gui.recent_list_load)
|
||||
gimp->gui.recent_list_load (gimp);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_mount_enclosing_volume (Gimp *gimp,
|
||||
GFile *file,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
|
||||
g_return_val_if_fail (G_IS_FILE (file), FALSE);
|
||||
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
if (gimp->gui.mount_enclosing_volume)
|
||||
return gimp->gui.mount_enclosing_volume (gimp, file, progress, error);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -93,6 +93,10 @@ struct _GimpGui
|
|||
const gchar *mime_type);
|
||||
void (* recent_list_load) (Gimp *gimp);
|
||||
|
||||
gboolean (* mount_enclosing_volume) (Gimp *gimp,
|
||||
GFile *file,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
};
|
||||
|
||||
|
||||
|
@ -171,5 +175,10 @@ gboolean gimp_recent_list_add_file (Gimp *gimp,
|
|||
const gchar *mime_type);
|
||||
void gimp_recent_list_load (Gimp *gimp);
|
||||
|
||||
gboolean gimp_mount_enclosing_volume (Gimp *gimp,
|
||||
GFile *file,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
|
||||
|
||||
#endif /* __GIMP_GUI_H__ */
|
||||
|
|
|
@ -88,8 +88,10 @@ static void gui_ungrab (Gimp *gimp);
|
|||
|
||||
static void gui_threads_enter (Gimp *gimp);
|
||||
static void gui_threads_leave (Gimp *gimp);
|
||||
|
||||
static void gui_set_busy (Gimp *gimp);
|
||||
static void gui_unset_busy (Gimp *gimp);
|
||||
|
||||
static void gui_help (Gimp *gimp,
|
||||
GimpProgress *progress,
|
||||
const gchar *help_domain,
|
||||
|
@ -142,6 +144,11 @@ static gboolean gui_recent_list_add_file (Gimp *gimp,
|
|||
const gchar *mime_type);
|
||||
static void gui_recent_list_load (Gimp *gimp);
|
||||
|
||||
static gboolean gui_mount_enclosing_volume (Gimp *gimp,
|
||||
GFile *file,
|
||||
GimpProgress *progress,
|
||||
GError **error);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
|
@ -176,6 +183,7 @@ gui_vtable_init (Gimp *gimp)
|
|||
gimp->gui.pdb_dialog_close = gui_pdb_dialog_close;
|
||||
gimp->gui.recent_list_add_file = gui_recent_list_add_file;
|
||||
gimp->gui.recent_list_load = gui_recent_list_load;
|
||||
gimp->gui.mount_enclosing_volume = gui_mount_enclosing_volume;
|
||||
}
|
||||
|
||||
|
||||
|
@ -732,3 +740,46 @@ gui_recent_list_load (Gimp *gimp)
|
|||
|
||||
gimp_container_thaw (gimp->documents);
|
||||
}
|
||||
|
||||
static void
|
||||
mount_volume_ready (GFile *file,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
g_file_mount_enclosing_volume_finish (file, res, error);
|
||||
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gui_mount_enclosing_volume (Gimp *gimp,
|
||||
GFile *file,
|
||||
GimpProgress *progress,
|
||||
GError **error)
|
||||
{
|
||||
GMountOperation *operation;
|
||||
GtkWidget *toplevel = NULL;
|
||||
GError *my_error = NULL;
|
||||
|
||||
if (GTK_IS_WIDGET (progress))
|
||||
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (progress));
|
||||
|
||||
operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
|
||||
|
||||
g_file_mount_enclosing_volume (file, G_MOUNT_MOUNT_NONE,
|
||||
operation,
|
||||
NULL,
|
||||
(GAsyncReadyCallback) mount_volume_ready,
|
||||
&my_error);
|
||||
gtk_main ();
|
||||
|
||||
g_object_unref (operation);
|
||||
|
||||
if (my_error)
|
||||
{
|
||||
g_propagate_error (error, my_error);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue