Commit 66aa141f authored by Alexander Schwinn's avatar Alexander Schwinn
Browse files

Re-introduce view-specific menu items (Bug #16654)

- Propagate "append-item" methods down into concrete view widgets
parent e80e1de9
Loading
Loading
Loading
Loading
+190 −32
Original line number Diff line number Diff line
@@ -63,9 +63,13 @@ static gboolean thunar_abstract_icon_view_get_visible_range (ThunarStand
static void         thunar_abstract_icon_view_highlight_path        (ThunarStandardView           *standard_view,
                                                                     GtkTreePath                  *path);
static GtkAction   *thunar_abstract_icon_view_gesture_action        (ThunarAbstractIconView       *abstract_icon_view);
static void         thunar_abstract_icon_view_action_sort           (GtkAction                    *action,
                                                                     GtkAction                    *current,
                                                                     ThunarStandardView           *standard_view);
static void         thunar_abstract_icon_view_connect_accelerators  (ThunarStandardView           *standard_view,
                                                                     GtkAccelGroup                *accel_group);
static void         thunar_abstract_icon_view_disconnect_accelerators(ThunarStandardView          *standard_view,
                                                                     GtkAccelGroup                *accel_group);
static void         thunar_abstract_icon_view_append_menu_items     (ThunarStandardView           *standard_view,
                                                                     GtkMenu                      *menu,
                                                                     GtkAccelGroup                *accel_group);
static void         thunar_abstract_icon_view_notify_model          (ExoIconView                  *view,
                                                                     GParamSpec                   *pspec,
                                                                     ThunarAbstractIconView       *abstract_icon_view);
@@ -90,14 +94,21 @@ static void thunar_abstract_icon_view_item_activated (ExoIconView
static void         thunar_abstract_icon_view_sort_column_changed   (GtkTreeSortable              *sortable,
                                                                     ThunarAbstractIconView       *abstract_icon_view);
static void         thunar_abstract_icon_view_zoom_level_changed    (ThunarAbstractIconView       *abstract_icon_view);


static void         thunar_abstract_icon_view_action_sort_by_name   (ThunarStandardView           *standard_view);
static void         thunar_abstract_icon_view_action_sort_by_size   (ThunarStandardView           *standard_view);
static void         thunar_abstract_icon_view_action_sort_by_type   (ThunarStandardView           *standard_view);
static void         thunar_abstract_icon_view_action_sort_by_date   (ThunarStandardView           *standard_view);
static void         thunar_abstract_icon_view_action_sort_ascending (ThunarStandardView           *standard_view);
static void         thunar_abstract_icon_view_action_sort_descending(ThunarStandardView           *standard_view);

struct _ThunarAbstractIconViewPrivate
{
  /* the UI manager merge id for the abstract icon view */
  gint ui_merge_id;

  GtkSortType sort_order;
  gint        sort_column;

  /* mouse gesture support */
  gint   gesture_start_x;
  gint   gesture_start_y;
@@ -133,6 +144,21 @@ static const GtkRadioActionEntry order_action_entries[] =



static XfceGtkActionEntry thunar_abstract_icon_view_action_entries[] =
{
    { THUNAR_ABSTRACT_ICON_VIEW_ACTION_ARRANGE_ITEMS_MENU, "<Actions>/ThunarStandardView/arrange-items-menu",    "", XFCE_GTK_MENU_ITEM,       N_ ("Arran_ge Items"),             NULL,                                                NULL, G_CALLBACK (NULL),                                             },
    { THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_NAME,       "<Actions>/ThunarStandardView/sort-by-name",          "", XFCE_GTK_RADIO_MENU_ITEM, N_ ("Sort By _Name"),              N_ ("Keep items sorted by their name"),              NULL, G_CALLBACK (thunar_abstract_icon_view_action_sort_by_name),    },
    { THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_SIZE,       "<Actions>/ThunarStandardView/sort-by-size",          "", XFCE_GTK_RADIO_MENU_ITEM, N_ ("Sort By _Size"),              N_ ("Keep items sorted by their size"),              NULL, G_CALLBACK (thunar_abstract_icon_view_action_sort_by_size),    },
    { THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_TYPE,       "<Actions>/ThunarStandardView/sort-by-type",          "", XFCE_GTK_RADIO_MENU_ITEM, N_ ("Sort By _Type"),              N_ ("Keep items sorted by their type"),              NULL, G_CALLBACK (thunar_abstract_icon_view_action_sort_by_type),    },
    { THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_MTIME,      "<Actions>/ThunarStandardView/sort-by-mtime",         "", XFCE_GTK_RADIO_MENU_ITEM, N_ ("Sort By Modification _Date"), N_ ("Keep items sorted by their modification date"), NULL, G_CALLBACK (thunar_abstract_icon_view_action_sort_by_date),    },
    { THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_ASCENDING,     "<Actions>/ThunarStandardView/sort-ascending",        "", XFCE_GTK_RADIO_MENU_ITEM, N_ ("_Ascending"),                 N_ ("Sort items in ascending order"),                NULL, G_CALLBACK (thunar_abstract_icon_view_action_sort_ascending),  },
    { THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_DESCENDING,    "<Actions>/ThunarStandardView/sort-descending",       "", XFCE_GTK_RADIO_MENU_ITEM, N_ ("_Descending"),                N_ ("Sort items in descending order"),               NULL, G_CALLBACK (thunar_abstract_icon_view_action_sort_descending), },
};

#define get_action_entry(id) xfce_gtk_get_action_entry_by_id(thunar_abstract_icon_view_action_entries,G_N_ELEMENTS(thunar_abstract_icon_view_action_entries),id)



G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ThunarAbstractIconView, thunar_abstract_icon_view, THUNAR_TYPE_STANDARD_VIEW)


@@ -159,6 +185,11 @@ thunar_abstract_icon_view_class_init (ThunarAbstractIconViewClass *klass)
  thunarstandard_view_class->get_path_at_pos = thunar_abstract_icon_view_get_path_at_pos;
  thunarstandard_view_class->get_visible_range = thunar_abstract_icon_view_get_visible_range;
  thunarstandard_view_class->highlight_path = thunar_abstract_icon_view_highlight_path;
  thunarstandard_view_class->append_menu_items = thunar_abstract_icon_view_append_menu_items;
  thunarstandard_view_class->connect_accelerators = thunar_abstract_icon_view_connect_accelerators;
  thunarstandard_view_class->disconnect_accelerators = thunar_abstract_icon_view_disconnect_accelerators;

  xfce_gtk_translate_action_entries (thunar_abstract_icon_view_action_entries, G_N_ELEMENTS (thunar_abstract_icon_view_action_entries));

  /**
   * ThunarAbstractIconView:column-spacing:
@@ -234,10 +265,10 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
                                GTK_WIDGET (abstract_icon_view));
  gtk_action_group_add_radio_actions (THUNAR_STANDARD_VIEW (abstract_icon_view)->action_group, column_action_entries,
                                      G_N_ELEMENTS (column_action_entries), THUNAR_COLUMN_NAME,
                                      G_CALLBACK (thunar_abstract_icon_view_action_sort), abstract_icon_view);
                                      G_CALLBACK (NULL), abstract_icon_view);
  gtk_action_group_add_radio_actions (THUNAR_STANDARD_VIEW (abstract_icon_view)->action_group, order_action_entries,
                                      G_N_ELEMENTS (order_action_entries), GTK_SORT_ASCENDING,
                                      G_CALLBACK (thunar_abstract_icon_view_action_sort), abstract_icon_view);
                                      G_CALLBACK (NULL), abstract_icon_view);
G_GNUC_END_IGNORE_DEPRECATIONS

  /* we need to listen to sort column changes to sync the menu items */
@@ -417,6 +448,93 @@ thunar_abstract_icon_view_highlight_path (ThunarStandardView *standard_view,



/**
 * thunar_abstract_icon_view_connect_accelerators:
 * @standard_view : a #ThunarStandardView
 * @accel_group : a #GtkAccelGroup to be used used for new menu items
 *
 * Connects all accelerators and corresponding default keys of this widget to the global accelerator list
 * The concrete implementation depends on the concrete widget which is implementing this view
 **/
static void
thunar_abstract_icon_view_connect_accelerators (ThunarStandardView *standard_view,
                                                GtkAccelGroup      *accel_group)
{
  ThunarAbstractIconView *abstract_icon_view = THUNAR_ABSTRACT_ICON_VIEW (standard_view);

  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  xfce_gtk_accel_map_add_entries (thunar_abstract_icon_view_action_entries,
                                 G_N_ELEMENTS (thunar_abstract_icon_view_action_entries));
  xfce_gtk_accel_group_connect_action_entries (accel_group,
                                               thunar_abstract_icon_view_action_entries,
                                               G_N_ELEMENTS (thunar_abstract_icon_view_action_entries),
                                               standard_view);
}



/**
 * thunar_abstract_icon_view_disconnect_accelerators:
 * @standard_view : a #ThunarStandardView
 * @accel_group : a #GtkAccelGroup to be used used for new menu items
 *
 * Disconnects all accelerators from the passed #GtkAccelGroup
 **/
static void
thunar_abstract_icon_view_disconnect_accelerators (ThunarStandardView *standard_view,
                                                   GtkAccelGroup      *accel_group)
{
  /* Dont listen to the accel keys defined by the action entries any more */
  xfce_gtk_accel_group_disconnect_action_entries (accel_group,
                                                  thunar_abstract_icon_view_action_entries,
                                                  G_N_ELEMENTS (thunar_abstract_icon_view_action_entries));
}



/**
 * thunar_abstract_icon_view_append_menu_items:
 * @standard_view : a #ThunarStandardView
 * @menu : the #GtkMenu to add the menu items
 * @accel_group : a #GtkAccelGroup to be used used for new menu items
 *
 * Appends widget-specific menu items to a #GtkMenu and connects them to the passed #GtkAccelGroup
 * Implements method 'append_menu_items' of #ThunarStandardView
 **/
static void
thunar_abstract_icon_view_append_menu_items (ThunarStandardView *standard_view,
                                             GtkMenu            *menu,
                                             GtkAccelGroup      *accel_group)
{
  ThunarAbstractIconView *abstract_icon_view = THUNAR_ABSTRACT_ICON_VIEW (standard_view);
  GtkWidget              *submenu;
  GtkWidget              *item;

  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  item = xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_ABSTRACT_ICON_VIEW_ACTION_ARRANGE_ITEMS_MENU), NULL, GTK_MENU_SHELL (menu));
  submenu =  gtk_menu_new();
  if (accel_group != NULL)
    gtk_menu_set_accel_group (GTK_MENU (submenu), accel_group);
  xfce_gtk_toggle_menu_item_new_from_action_entry (get_action_entry (THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_NAME), G_OBJECT (standard_view),
                                                 abstract_icon_view->priv->sort_column == THUNAR_COLUMN_NAME, GTK_MENU_SHELL (submenu));
  xfce_gtk_toggle_menu_item_new_from_action_entry (get_action_entry (THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_SIZE), G_OBJECT (standard_view),
                                                 abstract_icon_view->priv->sort_column == THUNAR_COLUMN_SIZE, GTK_MENU_SHELL (submenu));
  xfce_gtk_toggle_menu_item_new_from_action_entry (get_action_entry (THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_TYPE), G_OBJECT (standard_view),
                                                 abstract_icon_view->priv->sort_column == THUNAR_COLUMN_TYPE, GTK_MENU_SHELL (submenu));
  xfce_gtk_toggle_menu_item_new_from_action_entry (get_action_entry (THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_MTIME), G_OBJECT (standard_view),
                                                 abstract_icon_view->priv->sort_column == THUNAR_COLUMN_DATE_MODIFIED, GTK_MENU_SHELL (submenu));
  xfce_gtk_toggle_menu_item_new_from_action_entry (get_action_entry (THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_ASCENDING), G_OBJECT (standard_view),
                                                 abstract_icon_view->priv->sort_order == GTK_SORT_ASCENDING, GTK_MENU_SHELL (submenu));
  xfce_gtk_toggle_menu_item_new_from_action_entry (get_action_entry (THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_DESCENDING), G_OBJECT (standard_view),
                                                 abstract_icon_view->priv->sort_order == GTK_SORT_DESCENDING, GTK_MENU_SHELL (submenu));
  gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), GTK_WIDGET (submenu));
  gtk_widget_show (item);
}



static GtkAction*
thunar_abstract_icon_view_gesture_action (ThunarAbstractIconView *abstract_icon_view)
{
@@ -449,25 +567,73 @@ G_GNUC_END_IGNORE_DEPRECATIONS


static void
thunar_abstract_icon_view_action_sort (GtkAction          *action,
                                       GtkAction          *current,
                                       ThunarStandardView *standard_view)
thunar_abstract_icon_view_action_sort_by_name (ThunarStandardView *standard_view)
{
  GtkSortType order;
  gint        column;
  ThunarAbstractIconView *abstract_icon_view = THUNAR_ABSTRACT_ICON_VIEW (standard_view);

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  /* query the new sort column id */
  action = gtk_action_group_get_action (standard_view->action_group, "sort-by-name");
  column = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  /* query the new sort order */
  action = gtk_action_group_get_action (standard_view->action_group, "sort-ascending");
  order = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
G_GNUC_END_IGNORE_DEPRECATIONS
  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (standard_view->model), THUNAR_COLUMN_NAME, abstract_icon_view->priv->sort_order);
}

  /* apply the new settings */
  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (standard_view->model), column, order);


static void
thunar_abstract_icon_view_action_sort_by_size (ThunarStandardView *standard_view)
{
  ThunarAbstractIconView *abstract_icon_view = THUNAR_ABSTRACT_ICON_VIEW (standard_view);

  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (standard_view->model), THUNAR_COLUMN_SIZE, abstract_icon_view->priv->sort_order);
}



static void
thunar_abstract_icon_view_action_sort_by_type (ThunarStandardView *standard_view)
{
  ThunarAbstractIconView *abstract_icon_view = THUNAR_ABSTRACT_ICON_VIEW (standard_view);

  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (standard_view->model), THUNAR_COLUMN_TYPE, abstract_icon_view->priv->sort_order);
}



static void
thunar_abstract_icon_view_action_sort_by_date (ThunarStandardView *standard_view)
{
  ThunarAbstractIconView *abstract_icon_view = THUNAR_ABSTRACT_ICON_VIEW (standard_view);

  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (standard_view->model), THUNAR_COLUMN_DATE_MODIFIED, abstract_icon_view->priv->sort_order);
}



static void
thunar_abstract_icon_view_action_sort_ascending (ThunarStandardView *standard_view)
{
  ThunarAbstractIconView *abstract_icon_view = THUNAR_ABSTRACT_ICON_VIEW (standard_view);

  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (standard_view->model), abstract_icon_view->priv->sort_column, GTK_SORT_ASCENDING);
}



static void
thunar_abstract_icon_view_action_sort_descending (ThunarStandardView *standard_view)
{
  ThunarAbstractIconView *abstract_icon_view = THUNAR_ABSTRACT_ICON_VIEW (standard_view);

  _thunar_return_if_fail (THUNAR_IS_ABSTRACT_ICON_VIEW (abstract_icon_view));

  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (standard_view->model), abstract_icon_view->priv->sort_column, GTK_SORT_DESCENDING);
}


@@ -779,20 +945,12 @@ thunar_abstract_icon_view_sort_column_changed (GtkTreeSortable *sortable,
                                               ThunarAbstractIconView *abstract_icon_view)
{
  GtkSortType order;
  GtkAction  *action;
  gint        column;

  if (gtk_tree_sortable_get_sort_column_id (sortable, &column, &order))
    {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
      /* apply the new sort column */
      action = gtk_action_group_get_action (THUNAR_STANDARD_VIEW (abstract_icon_view)->action_group, "sort-by-name");
      gtk_radio_action_set_current_value (GTK_RADIO_ACTION (action), column);

      /* apply the new sort order */
      action = gtk_action_group_get_action (THUNAR_STANDARD_VIEW (abstract_icon_view)->action_group, "sort-ascending");
      gtk_radio_action_set_current_value (GTK_RADIO_ACTION (action), order);
G_GNUC_END_IGNORE_DEPRECATIONS
      abstract_icon_view->priv->sort_column = column;
      abstract_icon_view->priv->sort_order = order;
    }
}

+12 −0
Original line number Diff line number Diff line
@@ -35,6 +35,18 @@ typedef struct _ThunarAbstractIconView ThunarAbstractIconView;
#define THUNAR_IS_ABSTRACT_ICON_VIEW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((obj), THUNAR_TYPE_ABSTRACT_ICON_VIEW))
#define THUNAR_ABSTRACT_ICON_VIEW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_ABSTRACT_ICON_VIEW, ThunarAbstractIconViewClass))

/* #XfceGtkActionEntrys provided by this widget */
typedef enum
{
  THUNAR_ABSTRACT_ICON_VIEW_ACTION_ARRANGE_ITEMS_MENU,
  THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_NAME,
  THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_SIZE,
  THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_TYPE,
  THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_BY_MTIME,
  THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_ASCENDING,
  THUNAR_ABSTRACT_ICON_VIEW_ACTION_SORT_DESCENDING,
} ThunarAbstractIconViewAction;

struct _ThunarAbstractIconViewClass
{
  ThunarStandardViewClass __parent__;
+75 −18
Original line number Diff line number Diff line
@@ -105,11 +105,16 @@ static void thunar_details_view_row_changed (GtkTreeView
static void         thunar_details_view_columns_changed         (ThunarColumnModel      *column_model,
                                                                 ThunarDetailsView      *details_view);
static void         thunar_details_view_zoom_level_changed      (ThunarDetailsView      *details_view);
static void         thunar_details_view_action_setup_columns    (GtkAction              *action,
                                                                 ThunarDetailsView      *details_view);
static gboolean     thunar_details_view_get_fixed_columns       (ThunarDetailsView      *details_view);
static void         thunar_details_view_set_fixed_columns       (ThunarDetailsView      *details_view,
                                                                 gboolean                fixed_columns);
static void         thunar_details_view_connect_accelerators    (ThunarStandardView     *standard_view,
                                                                 GtkAccelGroup          *accel_group);
static void         thunar_details_view_disconnect_accelerators (ThunarStandardView     *standard_view,
                                                                 GtkAccelGroup          *accel_group);
static void         thunar_details_view_append_menu_items       (ThunarStandardView     *standard_view,
                                                                 GtkMenu                *menu,
                                                                 GtkAccelGroup          *accel_group);



@@ -140,11 +145,13 @@ struct _ThunarDetailsView



static const GtkActionEntry action_entries[] =
static XfceGtkActionEntry thunar_details_view_action_entries[] =
{
  { "setup-columns", NULL, N_ ("Configure _Columns..."), NULL, N_ ("Configure the columns in the detailed list view"), G_CALLBACK (thunar_details_view_action_setup_columns), },
    { THUNAR_DETAILS_VIEW_ACTION_CONFIGURE_COLUMNS, "<Actions>/ThunarStandardView/configure-columns", "", XFCE_GTK_MENU_ITEM , N_ ("Configure _Columns..."), N_("Configure the columns in the detailed list view"), NULL, G_CALLBACK (thunar_show_column_editor), },
};

#define get_action_entry(id) xfce_gtk_get_action_entry_by_id(thunar_details_view_action_entries,G_N_ELEMENTS(thunar_details_view_action_entries),id)



G_DEFINE_TYPE (ThunarDetailsView, thunar_details_view, THUNAR_TYPE_STANDARD_VIEW)
@@ -179,8 +186,13 @@ thunar_details_view_class_init (ThunarDetailsViewClass *klass)
  thunarstandard_view_class->get_path_at_pos = thunar_details_view_get_path_at_pos;
  thunarstandard_view_class->get_visible_range = thunar_details_view_get_visible_range;
  thunarstandard_view_class->highlight_path = thunar_details_view_highlight_path;
  thunarstandard_view_class->append_menu_items = thunar_details_view_append_menu_items;
  thunarstandard_view_class->connect_accelerators = thunar_details_view_connect_accelerators;
  thunarstandard_view_class->disconnect_accelerators = thunar_details_view_disconnect_accelerators;
  thunarstandard_view_class->zoom_level_property_name = "last-details-view-zoom-level";

  xfce_gtk_translate_action_entries (thunar_details_view_action_entries, G_N_ELEMENTS (thunar_details_view_action_entries));

  /**
   * ThunarDetailsView:fixed-columns:
   *
@@ -212,13 +224,6 @@ thunar_details_view_init (ThunarDetailsView *details_view)
   */
  g_signal_connect (G_OBJECT (details_view), "notify::zoom-level", G_CALLBACK (thunar_details_view_zoom_level_changed), NULL);

G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  /* setup the details view actions */
  gtk_action_group_add_actions (THUNAR_STANDARD_VIEW (details_view)->action_group,
                                action_entries, G_N_ELEMENTS (action_entries),
                                GTK_WIDGET (details_view));
G_GNUC_END_IGNORE_DEPRECATIONS

  /* create the tree view to embed */
  tree_view = exo_tree_view_new ();
  g_signal_connect (G_OBJECT (tree_view), "notify::model",
@@ -983,17 +988,69 @@ thunar_details_view_zoom_level_changed (ThunarDetailsView *details_view)



/**
 * thunar_details_view_connect_accelerators:
 * @standard_view : a #ThunarStandardView.
 * @accel_group   : a #GtkAccelGroup to be used used for new menu items
 *
 * Connects all accelerators and corresponding default keys of this widget to the global accelerator list
 * The concrete implementation depends on the concrete widget which is implementing this view
 **/
static void
thunar_details_view_action_setup_columns (GtkAction         *action,
                                          ThunarDetailsView *details_view)
thunar_details_view_connect_accelerators (ThunarStandardView *standard_view,
                                          GtkAccelGroup      *accel_group)
{
  ThunarDetailsView *details_view = THUNAR_DETAILS_VIEW (standard_view);

  _thunar_return_if_fail (THUNAR_IS_DETAILS_VIEW (details_view));

  xfce_gtk_accel_map_add_entries (thunar_details_view_action_entries, G_N_ELEMENTS (thunar_details_view_action_entries));
  xfce_gtk_accel_group_connect_action_entries (accel_group,
                                               thunar_details_view_action_entries,
                                               G_N_ELEMENTS (thunar_details_view_action_entries),
                                               standard_view);
}



/**
 * thunar_details_view_disconnect_accelerators:
 * @standard_view : a #ThunarStandardView.
 * @accel_group   : a #GtkAccelGroup to be disconnected
 *
 * Dont listen to the accel keys defined by the action entries any more
 **/
static void
thunar_details_view_disconnect_accelerators (ThunarStandardView *standard_view,
                                             GtkAccelGroup      *accel_group)
{
  /* Dont listen to the accel keys defined by the action entries any more */
  xfce_gtk_accel_group_disconnect_action_entries (accel_group,
                                                  thunar_details_view_action_entries,
                                                  G_N_ELEMENTS (thunar_details_view_action_entries));
}



/**
 * thunar_details_view_append_menu_items:
 * @standard_view : a #ThunarStandardView.
 * @menu          : the #GtkMenu to add the menu items.
 * @accel_group   : a #GtkAccelGroup to be used used for new menu items
 *
 * Appends widget-specific menu items to a #GtkMenu and connects them to the passed #GtkAccelGroup
 * Implements method 'append_menu_items' of #ThunarStandardView
 **/
static void
thunar_details_view_append_menu_items (ThunarStandardView *standard_view,
                                       GtkMenu            *menu,
                                       GtkAccelGroup      *accel_group)
{
  ThunarDetailsView *details_view = THUNAR_DETAILS_VIEW (standard_view);

  _thunar_return_if_fail (THUNAR_IS_DETAILS_VIEW (details_view));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  _thunar_return_if_fail (GTK_IS_ACTION (action));
G_GNUC_END_IGNORE_DEPRECATIONS

  /* popup the column editor dialog */
  thunar_show_column_editor (details_view);
  xfce_gtk_menu_item_new_from_action_entry (get_action_entry (THUNAR_DETAILS_VIEW_ACTION_CONFIGURE_COLUMNS), G_OBJECT (details_view), GTK_MENU_SHELL (menu));
}


+6 −0
Original line number Diff line number Diff line
@@ -34,6 +34,12 @@ typedef struct _ThunarDetailsView ThunarDetailsView;
#define THUNAR_IS_DETAILS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_DETAILS_VIEW))
#define THUNAR_DETAILS_VIEW_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_DETAILS_VIEW, ThunarDetailsViewClass))

/* #XfceGtkActionEntrys provided by this widget */
typedef enum
{
  THUNAR_DETAILS_VIEW_ACTION_CONFIGURE_COLUMNS,
} ThunarDetailsViewAction;

GType      thunar_details_view_get_type          (void) G_GNUC_CONST;

G_END_DECLS;
+24 −2

File changed.

Preview size limit exceeded, changes collapsed.

Loading