* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkrecentchooserutils.h"
#include "gtkrecentchooserprivate.h"
#include "gtkprivate.h"
-#include "gtkalias.h"
+
+/**
+ * SECTION:gtkrecentaction
+ * @Short_description: An action of which represents a list of recently used files
+ * @Title: GtkRecentAction
+ *
+ * A #GtkRecentAction represents a list of recently used files, which
+ * can be shown by widgets such as #GtkRecentChooserDialog or
+ * #GtkRecentChooserMenu.
+ *
+ * To construct a submenu showing recently used files, use a #GtkRecentAction
+ * as the action for a <menuitem>. To construct a menu toolbutton showing
+ * the recently used files in the popup menu, use a #GtkRecentAction as the
+ * action for a <toolitem> element.
+ */
+
#define FALLBACK_ITEM_LIMIT 10
-#define GTK_RECENT_ACTION_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
- GTK_TYPE_RECENT_ACTION, \
- GtkRecentActionPrivate))
struct _GtkRecentActionPrivate
{
static void
gtk_recent_action_select_all (GtkRecentChooser *chooser)
{
- g_warning (_("This function is not implemented for "
- "widgets of class '%s'"),
+ g_warning ("This function is not implemented for "
+ "widgets of class '%s'",
g_type_name (G_OBJECT_TYPE (chooser)));
}
static void
gtk_recent_action_unselect_all (GtkRecentChooser *chooser)
{
- g_warning (_("This function is not implemented for "
- "widgets of class '%s'"),
+ g_warning ("This function is not implemented for "
+ "widgets of class '%s'",
g_type_name (G_OBJECT_TYPE (chooser)));
}
static GtkRecentManager *
gtk_recent_action_get_recent_manager (GtkRecentChooser *chooser)
{
- return GTK_RECENT_ACTION_GET_PRIVATE (chooser)->manager;
+ return GTK_RECENT_ACTION (chooser)->priv->manager;
}
static void
gtk_recent_action_add_filter (GtkRecentChooser *chooser,
GtkRecentFilter *filter)
{
- GtkRecentActionPrivate *priv = GTK_RECENT_ACTION_GET_PRIVATE (chooser);
+ GtkRecentAction *action = GTK_RECENT_ACTION (chooser);
+ GtkRecentActionPrivate *priv = action->priv;
if (priv->current_filter != filter)
set_current_filter (GTK_RECENT_ACTION (chooser), filter);
gtk_recent_action_remove_filter (GtkRecentChooser *chooser,
GtkRecentFilter *filter)
{
- GtkRecentActionPrivate *priv = GTK_RECENT_ACTION_GET_PRIVATE (chooser);
+ GtkRecentAction *action = GTK_RECENT_ACTION (chooser);
+ GtkRecentActionPrivate *priv = action->priv;
if (priv->current_filter == filter)
set_current_filter (GTK_RECENT_ACTION (chooser), NULL);
static GSList *
gtk_recent_action_list_filters (GtkRecentChooser *chooser)
{
+ GtkRecentAction *action = GTK_RECENT_ACTION (chooser);
+ GtkRecentActionPrivate *priv = action->priv;
GSList *retval = NULL;
GtkRecentFilter *current_filter;
- current_filter = GTK_RECENT_ACTION_GET_PRIVATE (chooser)->current_filter;
+ current_filter = priv->current_filter;
retval = g_slist_prepend (retval, current_filter);
return retval;
static void
gtk_recent_action_activate (GtkAction *action)
{
+ GtkRecentAction *recent_action = GTK_RECENT_ACTION (action);
+ GtkRecentActionPrivate *priv = recent_action->priv;
+
/* we have probably been invoked by a menu tool button or by a
* direct call of gtk_action_activate(); since no item has been
* selected, we must unset the current recent chooser pointer
*/
- GTK_RECENT_ACTION_GET_PRIVATE (action)->current_chooser = NULL;
+ priv->current_chooser = NULL;
}
static void
GValue *value,
GParamSpec *pspec)
{
- GtkRecentActionPrivate *priv = GTK_RECENT_ACTION_GET_PRIVATE (gobject);
+ GtkRecentAction *action = GTK_RECENT_ACTION (gobject);
+ GtkRecentActionPrivate *priv = action->priv;
switch (prop_id)
{
{
GtkRecentActionPrivate *priv;
- action->priv = priv = GTK_RECENT_ACTION_GET_PRIVATE (action);
+ action->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (action,
+ GTK_TYPE_RECENT_ACTION,
+ GtkRecentActionPrivate);
priv->show_numbers = FALSE;
priv->show_icons = TRUE;
/**
* gtk_recent_action_new:
* @name: a unique name for the action
- * @label: (allow-none): the label displayed in menu items and on buttons, or %NULL
+ * @label: (allow-none): the label displayed in menu items and on buttons,
+ * or %NULL
* @tooltip: (allow-none): a tooltip for the action, or %NULL
- * @stock_id: the stock icon to display in widgets representing the
- * action, or %NULL
+ * @stock_id: (allow-none): the stock icon to display in widgets representing
+ * the action, or %NULL
*
* Creates a new #GtkRecentAction object. To add the action to
* a #GtkActionGroup and set the accelerator for the action,
/**
* gtk_recent_action_new_for_manager:
* @name: a unique name for the action
- * @label: (allow-none): the label displayed in menu items and on buttons, or %NULL
+ * @label: (allow-none): the label displayed in menu items and on buttons,
+ * or %NULL
* @tooltip: (allow-none): a tooltip for the action, or %NULL
- * @stock_id: the stock icon to display in widgets representing the
- * action, or %NULL
+ * @stock_id: (allow-none): the stock icon to display in widgets representing
+ * the action, or %NULL
* @manager: (allow-none): a #GtkRecentManager, or %NULL for using the default
* #GtkRecentManager
*
g_object_unref (action);
}
}
-
-#define __GTK_RECENT_ACTION_C__
-#include "gtkaliasdef.c"