summaryrefslogtreecommitdiff
path: root/libpeas-gtk/peas-gtk-configurable.c
blob: afd634cb53a8d49710567b7484ed3109c1096262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
 * peas-gtk-configurable.c
 * This file is part of libpeas
 *
 * Copyright (C) 2009-2010 Steve Frécinaux
 *
 * libpeas is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * libpeas is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "peas-gtk-configurable.h"

/**
 * PeasGtkConfigurable:
 *
 * Interface for providing a plugin configuration UI.
 *
 * The #PeasGtkConfigurable interface will allow a plugin to provide a
 * graphical interface for the user to configure the plugin through the
 * [class@PluginManager]: the #PeasGtkPluginManager will make its
 * “Configure Plugin” button active when the selected plugin implements
 * the #PeasGtkConfigurable interface.
 *
 * To allow plugin configuration from the #PeasGtkPluginManager, the
 * plugin writer will just need to implement the
 * [method@Configurable.create_configure_widget] method.
 **/

G_DEFINE_INTERFACE(PeasGtkConfigurable, peas_gtk_configurable, G_TYPE_OBJECT)

static void
peas_gtk_configurable_default_init (PeasGtkConfigurableInterface *iface)
{
}

/**
 * peas_gtk_configurable_create_configure_widget:
 * @configurable: A #PeasGtkConfigurable
 *
 * Creates the configure widget for the plugin.
 *
 * The returned widget should allow configuring all the relevant aspects of the
 * plugin, and should allow instant-apply, as promoted by the Gnome Human
 * Interface Guidelines.
 *
 * [class@PluginManager] will embed the returned widget into a dialog box,
 * but you shouldn't take this behaviour for granted as other implementations
 * of a plugin manager UI might do otherwise.
 *
 * This method should always return a valid [class@Gtk.Widget] instance, never %NULL.
 *
 * Returns: (transfer full): A #GtkWidget used for configuration.
 */
GtkWidget *
peas_gtk_configurable_create_configure_widget (PeasGtkConfigurable *configurable)
{
  PeasGtkConfigurableInterface *iface;

  g_return_val_if_fail (PEAS_GTK_IS_CONFIGURABLE (configurable), NULL);

  iface = PEAS_GTK_CONFIGURABLE_GET_IFACE (configurable);

  if (G_LIKELY (iface->create_configure_widget != NULL))
    return iface->create_configure_widget (configurable);

  /* Default implementation */
  return NULL;
}