diff options
author | Wu Xiaotian <[email protected]> | 2019-07-20 14:58:18 +0800 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-08-26 14:21:14 +0200 |
commit | 093aacfeccdb47b6b12b1978dd88243479626398 (patch) | |
tree | 4e03f0d98674e9e3087512ebd07fc220a3cac6c6 | |
parent | 840f8890e05dab73d9ded916947973032d9d0091 (diff) | |
download | caja-093aacfeccdb47b6b12b1978dd88243479626398.tar.bz2 caja-093aacfeccdb47b6b12b1978dd88243479626398.tar.xz |
Set FmWidgetView is single view.
-rw-r--r-- | libcaja-private/caja-view-factory.c | 11 | ||||
-rw-r--r-- | libcaja-private/caja-view-factory.h | 1 | ||||
-rw-r--r-- | src/file-manager/fm-desktop-icon-view.c | 16 | ||||
-rw-r--r-- | src/file-manager/fm-empty-view.c | 16 | ||||
-rw-r--r-- | src/file-manager/fm-icon-view.c | 32 | ||||
-rw-r--r-- | src/file-manager/fm-list-view.c | 16 | ||||
-rw-r--r-- | src/file-manager/fm-widget-view.c | 17 | ||||
-rw-r--r-- | src/file-manager/fm-widget-view.h | 2 |
8 files changed, 60 insertions, 51 deletions
diff --git a/libcaja-private/caja-view-factory.c b/libcaja-private/caja-view-factory.c index abe291c1..e5e4219f 100644 --- a/libcaja-private/caja-view-factory.c +++ b/libcaja-private/caja-view-factory.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- caja-view-factory.c: register and create CajaViews @@ -116,7 +116,14 @@ caja_view_factory_get_views_for_uri (const char *uri, if (view_info->supports_uri (uri, file_type, mime_type)) { - res = g_list_prepend (res, g_strdup (view_info->id)); + if (view_info->single_view) + { + g_list_free_full (res, g_free); + res = g_list_prepend (NULL, g_strdup (view_info->id)); + break; + } else { + res = g_list_prepend (res, g_strdup (view_info->id)); + } } } diff --git a/libcaja-private/caja-view-factory.h b/libcaja-private/caja-view-factory.h index 294c2245..65d9124c 100644 --- a/libcaja-private/caja-view-factory.h +++ b/libcaja-private/caja-view-factory.h @@ -46,6 +46,7 @@ extern "C" { char *error_label; /* The foo view encountered an error. */ char *startup_error_label; /* The foo view encountered an error while starting up. */ char *display_location_label; /* Display this location with the foo view. */ + gboolean single_view; CajaView * (*create) (CajaWindowSlotInfo *slot); /* MATECOMPONENTTODO: More args here */ gboolean (*supports_uri) (const char *uri, diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 7ee0394e..1efb2578 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -882,14 +882,14 @@ fm_desktop_icon_view_supports_uri (const char *uri, static CajaViewInfo fm_desktop_icon_view = { - FM_DESKTOP_ICON_VIEW_ID, - "Desktop View", - "_Desktop", - N_("The desktop view encountered an error."), - N_("The desktop view encountered an error while starting up."), - "Display this location with the desktop view.", - fm_desktop_icon_view_create, - fm_desktop_icon_view_supports_uri + .id = FM_DESKTOP_ICON_VIEW_ID, + .view_combo_label = "Desktop View", + .view_menu_label_with_mnemonic = "_Desktop", + .error_label = N_("The desktop view encountered an error."), + .startup_error_label = N_("The desktop view encountered an error while starting up."), + .display_location_label = "Display this location with the desktop view.", + .create = fm_desktop_icon_view_create, + .supports_uri = fm_desktop_icon_view_supports_uri }; void diff --git a/src/file-manager/fm-empty-view.c b/src/file-manager/fm-empty-view.c index ada809ee..3aff6ec6 100644 --- a/src/file-manager/fm-empty-view.c +++ b/src/file-manager/fm-empty-view.c @@ -392,14 +392,14 @@ fm_empty_view_supports_uri (const char *uri, static CajaViewInfo fm_empty_view = { - FM_EMPTY_VIEW_ID, - "Empty", - "Empty View", - "_Empty View", - "The empty view encountered an error.", - "Display this location with the empty view.", - fm_empty_view_create, - fm_empty_view_supports_uri + .id = FM_EMPTY_VIEW_ID, + .view_combo_label = "Empty", + .view_menu_label_with_mnemonic = "Empty View", + .error_label = "_Empty View", + .startup_error_label = "The empty view encountered an error.", + .display_location_label = "Display this location with the empty view.", + .create = fm_empty_view_create, + .supports_uri =fm_empty_view_supports_uri }; void diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index a8008a77..82441e93 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -3430,32 +3430,32 @@ fm_icon_view_supports_uri (const char *uri, static CajaViewInfo fm_icon_view = { - FM_ICON_VIEW_ID, + .id = FM_ICON_VIEW_ID, /* Translators: this is used in the view selection dropdown * of navigation windows and in the preferences dialog */ - N_("Icon View"), + .view_combo_label = N_("Icon View"), /* Translators: this is used in the view menu */ - N_("_Icons"), - N_("The icon view encountered an error."), - N_("The icon view encountered an error while starting up."), - N_("Display this location with the icon view."), - fm_icon_view_create, - fm_icon_view_supports_uri + .view_menu_label_with_mnemonic = N_("_Icons"), + .error_label = N_("The icon view encountered an error."), + .startup_error_label = N_("The icon view encountered an error while starting up."), + .display_location_label = N_("Display this location with the icon view."), + .create = fm_icon_view_create, + .supports_uri = fm_icon_view_supports_uri }; static CajaViewInfo fm_compact_view = { - FM_COMPACT_VIEW_ID, + .id = FM_COMPACT_VIEW_ID, /* Translators: this is used in the view selection dropdown * of navigation windows and in the preferences dialog */ - N_("Compact View"), + .view_combo_label = N_("Compact View"), /* Translators: this is used in the view menu */ - N_("_Compact"), - N_("The compact view encountered an error."), - N_("The compact view encountered an error while starting up."), - N_("Display this location with the compact view."), - fm_compact_view_create, - fm_icon_view_supports_uri + .view_menu_label_with_mnemonic = N_("_Compact"), + .error_label = N_("The compact view encountered an error."), + .startup_error_label = N_("The compact view encountered an error while starting up."), + .display_location_label = N_("Display this location with the compact view."), + .create = fm_compact_view_create, + .supports_uri = fm_icon_view_supports_uri }; gboolean diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c index 6b4bda03..bfc29c2c 100644 --- a/src/file-manager/fm-list-view.c +++ b/src/file-manager/fm-list-view.c @@ -3492,17 +3492,17 @@ fm_list_view_supports_uri (const char *uri, static CajaViewInfo fm_list_view = { - FM_LIST_VIEW_ID, + .id = FM_LIST_VIEW_ID, /* Translators: this is used in the view selection dropdown * of navigation windows and in the preferences dialog */ - N_("List View"), + .view_combo_label = N_("List View"), /* Translators: this is used in the view menu */ - N_("_List"), - N_("The list view encountered an error."), - N_("The list view encountered an error while starting up."), - N_("Display this location with the list view."), - fm_list_view_create, - fm_list_view_supports_uri + .view_menu_label_with_mnemonic = N_("_List"), + .error_label = N_("The list view encountered an error."), + .startup_error_label = N_("The list view encountered an error while starting up."), + .display_location_label = N_("Display this location with the list view."), + .create = fm_list_view_create, + .supports_uri = fm_list_view_supports_uri }; void diff --git a/src/file-manager/fm-widget-view.c b/src/file-manager/fm-widget-view.c index 482ee4a3..9d2aeff1 100644 --- a/src/file-manager/fm-widget-view.c +++ b/src/file-manager/fm-widget-view.c @@ -374,15 +374,15 @@ fm_widget_view_supports_uri (const char *uri, static CajaViewInfo fm_widget_view = { - FM_WIDGET_VIEW_ID, - N_("Widget View"), + .id = FM_WIDGET_VIEW_ID, + .view_combo_label = N_("Widget View"), /* translators: this is used in the view menu */ - N_("_Widget View"), - N_("The widget view encountered an error."), - N_("The widget view encountered an error while starting up."), - N_("Display this location with the widget view."), - fm_widget_view_create, - fm_widget_view_supports_uri + .view_menu_label_with_mnemonic = N_("_Widget View"), + .error_label = N_("The widget view encountered an error."), + .startup_error_label = N_("The widget view encountered an error while starting up."), + .display_location_label = N_("Display this location with the widget view."), + .create = fm_widget_view_create, + .supports_uri = fm_widget_view_supports_uri }; void @@ -394,6 +394,7 @@ fm_widget_view_register (void) fm_widget_view.error_label = _(fm_widget_view.error_label); fm_widget_view.startup_error_label = _(fm_widget_view.startup_error_label); fm_widget_view.display_location_label = _(fm_widget_view.display_location_label); + fm_widget_view.single_view = TRUE; caja_view_factory_register (&fm_widget_view); } diff --git a/src/file-manager/fm-widget-view.h b/src/file-manager/fm-widget-view.h index 9f0a3f09..6ff29699 100644 --- a/src/file-manager/fm-widget-view.h +++ b/src/file-manager/fm-widget-view.h @@ -27,7 +27,7 @@ G_BEGIN_DECLS -#define FM_WIDGET_VIEW_ID "OAFIID:Caja_File_Manager_Widget_View" +#define FM_WIDGET_VIEW_ID "OAFIID:Caja_File_Manager_Widget_View" #define FM_TYPE_WIDGET_VIEW (fm_widget_view_get_type ()) G_DECLARE_FINAL_TYPE (FMWidgetView, fm_widget_view, FM, WIDGET_VIEW, FMDirectoryView) |