Commit da42530d authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

libgnome-panel: initial version

parent caed969c
This diff is collapsed.
NULL =
SUBDIRS = \
libgnome-panel \
gnome-panel \
libpanel-applet \
applets \
......
......@@ -68,6 +68,9 @@ LT_LIB_M
LIB_PANEL_APPLET_LT_VERSION=2:0:0
AC_SUBST(LIB_PANEL_APPLET_LT_VERSION)
LIBGNOME_PANEL_LT_VERSION=0:0:0
AC_SUBST([LIBGNOME_PANEL_LT_VERSION])
AC_ARG_ENABLE([documentation],
AS_HELP_STRING([--enable-documentation], [enable man pages and HTML]),
[], [enable_documentation=yes])
......@@ -80,6 +83,7 @@ AC_PROG_CC
AM_PATH_PYTHON
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
GLIB_GSETTINGS
......@@ -122,6 +126,11 @@ PKG_CHECK_MODULES([PANEL], [
xrandr >= $XRANDR_REQUIRED
])
PKG_CHECK_MODULES([LIBGNOME_PANEL], [
gio-2.0 >= $GLIB_REQUIRED
gtk+-3.0 >= $GTK_REQUIRED
])
PKG_CHECK_MODULES([LIBPANEL_APPLET], [
gtk+-3.0 >= $GTK_REQUIRED
cairo-xlib
......@@ -248,6 +257,9 @@ AC_CONFIG_FILES([
data/48x48/Makefile
data/scalable/Makefile
data/pkgconfig/Makefile
data/pkgconfig/libgnome-panel.pc
data/theme/Makefile
data/theme/Adwaita/Makefile
data/theme/HighContrast/Makefile
......@@ -256,6 +268,8 @@ AC_CONFIG_FILES([
gnome-panel/libpanel-applet-private/Makefile
gnome-panel/libpanel-util/Makefile
libgnome-panel/Makefile
libpanel-applet/Makefile
libpanel-applet/libpanel-applet.pc
......
......@@ -2,6 +2,7 @@ NULL =
SUBDIRS = \
16x16 22x22 24x24 32x32 48x48 scalable \
pkgconfig \
theme \
$(NULL)
......
NULL =
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgnome-panel.pc
EXTRA_DIST = \
libgnome-panel.pc.in \
$(NULL)
CLEANFILES = \
$(pkgconfig_DATA) \
$(NULL)
-include $(top_srcdir)/git.mk
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
appletsdir=@libdir@/gnome-panel/applets
Name: libgnome-panel
Description: libgnome-panel
Requires: glib-2.0 gtk+-3.0
Version: @VERSION@
Libs: -L${libdir} -lgnome-panel
Cflags: -I${includedir}/gnome-panel
NULL =
lib_LTLIBRARIES = libgnome-panel.la
libgnome_panel_la_SOURCES = \
gp-applet.c \
gp-applet.h \
gp-applet-info.c \
gp-applet-info.h \
gp-applet-info-private.h \
gp-applet-private.h \
gp-module.h \
gp-module-info.c \
gp-module-info.h \
gp-module-info-private.h \
$(BUILT_SOURCES) \
$(NULL)
libgnome_panel_la_CPPFLAGS = \
-DG_LOG_DOMAIN=\"libgnome-panel\" \
-DG_LOG_USE_STRUCTURED=1 \
-I$(top_srcdir) \
$(AM_CPPFLAGS) \
$(NULL)
libgnome_panel_la_CFLAGS = \
$(LIBGNOME_PANEL_CFLAGS) \
$(WARN_CFLAGS) \
$(AM_CFLAGS) \
$(NULL)
libgnome_panel_la_LDFLAGS = \
-version-info $(LIBGNOME_PANEL_LT_VERSION) \
$(WARN_LDFLAGS) \
$(AM_LDFLAGS) \
$(NULL)
libgnome_panel_la_LIBADD = \
$(LIBGNOME_PANEL_LIBS) \
$(NULL)
libgnome_panel_includedir = $(includedir)/gnome-panel/libgnome-panel
libgnome_panel_include_HEADERS = \
gp-applet.h \
gp-applet-info.h \
gp-enum-types.h \
gp-module.h \
gp-module-info.h \
$(NULL)
ENUM_TYPES = \
$(srcdir)/gp-applet.h \
$(NULL)
gp-enum-types.c: gp-enum-types.c.in gp-enum-types.h $(ENUM_TYPES)
$(AM_V_GEN) $(GLIB_MKENUMS) --template $(srcdir)/gp-enum-types.c.in $(ENUM_TYPES) > \
gp-enum-types.c.tmp && mv gp-enum-types.c.tmp gp-enum-types.c
gp-enum-types.h: gp-enum-types.h.in $(ENUM_TYPES)
$(AM_V_GEN) $(GLIB_MKENUMS) --template $(srcdir)/gp-enum-types.h.in $(ENUM_TYPES) > \
gp-enum-types.h.tmp && mv gp-enum-types.h.tmp gp-enum-types.h
BUILT_SOURCES = \
gp-enum-types.c \
gp-enum-types.h \
$(NULL)
EXTRA_DIST = \
gp-enum-types.c.in \
gp-enum-types.h.in \
$(NULL)
CLEANFILES = \
$(BUILT_SOURCES) \
$(NULL)
-include $(top_srcdir)/git.mk
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library 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, see <https://www.gnu.org/licenses/>.
*/
#ifndef GP_APPLET_INFO_PRIVATE_H
#define GP_APPLET_INFO_PRIVATE_H
#include "libgnome-panel/gp-applet-info.h"
struct _GpAppletInfo
{
gchar *name;
gchar *description;
gchar *icon;
gchar *help_uri;
gchar *backends;
};
void gp_applet_info_free (GpAppletInfo *info);
G_END_DECLS
#endif
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library 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, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gp-applet-info-private.h"
/**
* gp_applet_info_new:
* @name: the name of this applet
* @description: the description of this applet
* @icon: the icon name for this applet
*
* Creates a new #GpAppletInfo.
*
* Returns: (transfer full): a newly created #GpAppletInfo.
*/
GpAppletInfo *
gp_applet_info_new (const gchar *name,
const gchar *description,
const gchar *icon)
{
GpAppletInfo *info;
info = g_new0 (GpAppletInfo, 1);
info->name = g_strdup (name);
info->description = g_strdup (description);
info->icon = g_strdup (icon);
return info;
}
/**
* gp_applet_info_set_backends:
* @info: a #GpAppletInfo
* @backends: (nullable): a comma-separated list of backends
*
* Sets a list of backends that this applet supports.
*/
void
gp_applet_info_set_backends (GpAppletInfo *info,
const gchar *backends)
{
g_free (info->backends);
info->backends = g_strdup (backends);
}
/**
* gp_applet_info_set_help_uri:
* @info: a #GpAppletInfo
* @help_uri: the help uri
*
* Sets the help uri.
*/
void
gp_applet_info_set_help_uri (GpAppletInfo *info,
const gchar *help_uri)
{
g_free (info->help_uri);
info->help_uri = g_strdup (help_uri);
}
void
gp_applet_info_free (GpAppletInfo *info)
{
if (info == NULL)
return;
g_free (info->name);
g_free (info->description);
g_free (info->icon);
g_free (info->help_uri);
g_free (info->backends);
g_free (info);
}
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library 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, see <https://www.gnu.org/licenses/>.
*/
#ifndef GP_APPLET_INFO_H
#define GP_APPLET_INFO_H
#include <glib-object.h>
G_BEGIN_DECLS
/**
* GpAppletInfo:
*
* The #GpAppletInfo struct is an opaque data structure.
*/
typedef struct _GpAppletInfo GpAppletInfo;
GpAppletInfo *gp_applet_info_new (const gchar *name,
const gchar *description,
const gchar *icon);
void gp_applet_info_set_backends (GpAppletInfo *info,
const gchar *backends);
void gp_applet_info_set_help_uri (GpAppletInfo *info,
const gchar *help_uri);
G_END_DECLS
#endif
/*
* Copyright (C) 2001 Sun Microsystems, Inc.
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library 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, see <https://www.gnu.org/licenses/>.
*
* Authors:
* Alberts Muktupāvels <alberts.muktupavels@gmail.com>
* Mark McLoughlin <mark@skynet.ie>
*/
#ifndef GP_APPLET_PRIVATE_H
#define GP_APPLET_PRIVATE_H
#include "libgnome-panel/gp-applet.h"
G_BEGIN_DECLS
void gp_applet_set_locked_down (GpApplet *applet,
gboolean locked_down);
void gp_applet_set_orientation (GpApplet *applet,
GtkOrientation orientation);
void gp_applet_set_position (GpApplet *applet,
GtkPositionType position);
GArray *gp_applet_get_size_hints (GpApplet *applet);
GtkWidget *gp_applet_get_menu (GpApplet *applet);
G_END_DECLS
#endif
This diff is collapsed.
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library 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, see <https://www.gnu.org/licenses/>.
*/
#ifndef GP_APPLET_H
#define GP_APPLET_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
/**
* GP_TYPE_APPLET:
*
* The type for GpApplet.
*/
#define GP_TYPE_APPLET gp_applet_get_type ()
G_DECLARE_DERIVABLE_TYPE (GpApplet, gp_applet, GP, APPLET, GtkEventBox)
/**
* GpAppletFlags:
* @GP_APPLET_FLAGS_NONE: No flags set.
* @GP_APPLET_FLAGS_EXPAND_MAJOR: On horizontal panels, the #GpApplet will
* be allocated as much width as possible. On vertical panels, it will
* be allocated as much height as possible.
* @GP_APPLET_FLAGS_EXPAND_MINOR: On horizontal panels, the #GpApplet will
* be allocated the full height of the panel. On vertical panels, it
* will be allocated the full width. Most applets should set this flag
* in order to use full panel size and allow the applet to be Fitt's Law
* compliant.
* @GP_APPLET_FLAGS_HAS_HANDLE: The panel will draw a handle for the
* #GpApplet. This handle will be usable to move the applet, and to open
* the context menu of the applet.
*
* Flags to be used with gp_applet_get_flags() and gp_applet_set_flags(),
* to indicate to the panel a specific behavior requested by the #GpApplet.
*/
typedef enum
{
GP_APPLET_FLAGS_NONE = 0,
GP_APPLET_FLAGS_EXPAND_MAJOR = 1 << 0,
GP_APPLET_FLAGS_EXPAND_MINOR = 1 << 1,
GP_APPLET_FLAGS_HAS_HANDLE = 1 << 2
} GpAppletFlags;
/**
* GpAppletClass:
* @parent_class: The parent class.
* @locked_down_changed: Signal is emmited when the locked down property
* of applet has changed.
* @placement_changed: Signal is emitted when the orientation or position
* properties of applet has changed.
*
* The class structure for the #GpApplet class.
*/
struct _GpAppletClass
{
GtkEventBoxClass parent_class;
void (* locked_down_changed) (GpApplet *applet,
gboolean locked_down);
void (* placement_changed) (GpApplet *applet,
GtkOrientation orientation,
GtkPositionType position);
/*< private >*/
gpointer padding[10];
};
gboolean gp_applet_get_locked_down (GpApplet *applet);
GtkOrientation gp_applet_get_orientation (GpApplet *applet);
GtkPositionType gp_applet_get_position (GpApplet *applet);
GpAppletFlags gp_applet_get_flags (GpApplet *applet);
void gp_applet_set_flags (GpApplet *applet,
GpAppletFlags flags);
void gp_applet_set_size_hints (GpApplet *applet,
const gint *size_hints,
guint n_elements,
gint base_size);
GSettings *gp_applet_settings_new (GpApplet *applet,
const gchar *schema);
void gp_applet_request_focus (GpApplet *applet,
guint32 timestamp);
void gp_applet_setup_menu (GpApplet *applet,
const gchar *xml,
const GActionEntry *entries);
void gp_applet_setup_menu_from_file (GpApplet *applet,
const gchar *filename,
const GActionEntry *entries);
void gp_applet_setup_menu_from_resource (GpApplet *applet,
const gchar *resource_path,
const GActionEntry *entries);
GAction *gp_applet_menu_lookup_action (GpApplet *applet,
const gchar *action_name);
void gp_applet_add_text_class (GpApplet *applet,
GtkWidget *widget);
G_END_DECLS
#endif
/*** BEGIN file-header ***/
#include "gp-enum-types.h"
/*** END file-header ***/
/*** BEGIN file-production ***/
#include "@filename@"
/*** END file-production ***/
/*** BEGIN value-header ***/
GType
@enum_name@_get_type (void)
{
static volatile gsize g_enum_type_id__volatile = 0;
if (g_once_init_enter (&g_enum_type_id__volatile))
{
static const G@Type@Value values[] = {
/*** END value-header ***/
/*** BEGIN value-production ***/
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
/*** END value-production ***/
/*** BEGIN value-tail ***/
{ 0, NULL, NULL }
};
GType g_enum_type_id;
g_enum_type_id = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id);
}
return g_enum_type_id__volatile;
}
/*** END value-tail ***/
/*** BEGIN file-header ***/
#ifndef GP_ENUM_TYPES_H
#define GP_ENUM_TYPES_H
#include <glib-object.h>
G_BEGIN_DECLS
/*** END file-header ***/
/*** BEGIN value-header ***/
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define GP_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
/*** END value-header ***/
/*** BEGIN file-tail ***/
G_END_DECLS
#endif
/*** END file-tail ***/
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library 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, see <https://www.gnu.org/licenses/>.
*/
#ifndef GP_MODULE_INFO_PRIVATE_H
#define GP_MODULE_INFO_PRIVATE_H
#include "libgnome-panel/gp-module-info.h"
G_BEGIN_DECLS
struct _GpModuleInfo
{
gchar *id;
gchar *version;
gchar *translation_domain;
gchar **applets;
};
void gp_module_info_free (GpModuleInfo *info);
G_END_DECLS
#endif
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library 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, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <stdarg.h>
#include "gp-module-info-private.h"
static gchar **
get_applets (va_list args)
{
GPtrArray *array;
const gchar *applet;
array = g_ptr_array_new ();
while ((applet = va_arg (args, const gchar *)) != NULL)
g_ptr_array_add (array, g_strdup (applet));
g_ptr_array_add (array, NULL);
return (gchar **) g_ptr_array_free (array, FALSE);
}
/**
* gp_module_info_new:
* @id: the id of this module
* @version: the version of this module
* @translation_domain: the translation domain or NULL
* @...: a %NULL-terminated list of applet ids in this module
*
* Creates a new #GpModuleInfo.
*
* Returns: (transfer full): a newly created #GpModuleInfo.
*/
GpModuleInfo *
gp_module_info_new (const gchar *id,
const gchar *version,
const gchar *translation_domain,
...)
{
GpModuleInfo *info;
va_list args;
info = g_new0 (GpModuleInfo, 1);
info->id = g_strdup (id);
info->version = g_strdup (version);
info->translation_domain = g_strdup (translation_domain);
va_start (args, translation_domain);
info->applets = get_applets (args);
va_end (args);
return info;
}
void
gp_module_info_free (GpModuleInfo *info)
{
if (info == NULL)
return;
g_free (info->id);
g_free (info->version);
g_free (info->translation_domain);
g_strfreev (info->applets);
g_free (info);
}
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library 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, see <https://www.gnu.org/licenses/>.
*/
#ifndef GP_MODULE_INFO_H
#define GP_MODULE_INFO_H
#include <glib.h>
G_BEGIN_DECLS
/**
* GpModuleInfo:
*
* The #GpModuleInfo struct is an opaque data structure.
*/
typedef struct _GpModuleInfo GpModuleInfo;
GpModuleInfo *gp_module_info_new (const gchar *id,
const gchar *version,
const gchar *translation_domain,
...);
G_END_DECLS
#endif
/*
* Copyright (C) 2016 Alberts Muktupāvels
*
* This library 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.
*
* This library is distributed in the hope that it will be useful, but