Skip to content

Commit

Permalink
Merge pull request flatpak#9 from matthiasclasen/check-options
Browse files Browse the repository at this point in the history
Be more careful with labels
  • Loading branch information
alexlarsson authored Jun 27, 2016
2 parents cf7b1e3 + 15dba46 commit d301234
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
4 changes: 1 addition & 3 deletions appchooser.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,8 @@ handle_choose_application (XdpAppChooser *object,
const char *title;
const char *heading;

if (!g_variant_lookup (arg_options, "cancel_label", "&s", &cancel_label))
cancel_label = "_Cancel";
if (!g_variant_lookup (arg_options, "accept_label", "&s", &accept_label))
accept_label = "_Open";
accept_label = "_Select";
if (!g_variant_lookup (arg_options, "title", "&s", &title))
title = "Open With";
if (!g_variant_lookup (arg_options, "heading", "&s", &heading))
Expand Down
25 changes: 13 additions & 12 deletions filechooser.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,6 @@ handle_file_chooser_open (XdpFileChooser *object,
else if (strcmp (method_name, "OpenFiles") == 0)
multiple = TRUE;

if (!g_variant_lookup (arg_options, "cancel_label", "&s", &cancel_label))
cancel_label = "_Cancel";
if (!g_variant_lookup (arg_options, "accept_label", "&s", &accept_label))
accept_label = "_Open";

Expand All @@ -289,16 +287,19 @@ handle_file_chooser_open (XdpFileChooser *object,
}
g_variant_iter_free (iter);
}
if (g_variant_lookup (arg_options, "current_name", "&s", &current_name))
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), current_name);
/* TODO: is this useful ?
* In a sandboxed situation, the current folder and current file
* are likely in the fuse filesystem
*/
if (g_variant_lookup (arg_options, "current_folder", "&ay", &path))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), path);
if (g_variant_lookup (arg_options, "current_file", "&ay", &path))
gtk_file_chooser_select_filename (GTK_FILE_CHOOSER (dialog), path);
if (strcmp (method_name, "SaveFile") == 0)
{
if (g_variant_lookup (arg_options, "current_name", "&s", &current_name))
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), current_name);
/* TODO: is this useful ?
* In a sandboxed situation, the current folder and current file
* are likely in the fuse filesystem
*/
if (g_variant_lookup (arg_options, "current_folder", "&ay", &path))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), path);
if (g_variant_lookup (arg_options, "current_file", "&ay", &path))
gtk_file_chooser_select_filename (GTK_FILE_CHOOSER (dialog), path);
}

g_object_unref (fake_parent);

Expand Down

0 comments on commit d301234

Please sign in to comment.