From 1606c1d6ae28b8425b56758ce0fc27c7fcbcc0e6 Mon Sep 17 00:00:00 2001 From: Jasmine Hassan Date: Wed, 5 Dec 2012 03:13:27 +0200 Subject: [font] remove outdated (disabled by default) plugin & schema Was used to setup old X legacy fonts, and was disabled by default in bug: https://bugzilla.gnome.org/show_bug.cgi?id=613604 --- plugins/Makefile.am | 1 - plugins/font/Makefile.am | 51 ---- plugins/font/delayed-dialog.c | 122 --------- plugins/font/delayed-dialog.h | 36 --- plugins/font/font.mate-settings-plugin.in | 8 - plugins/font/msd-font-manager.c | 438 ------------------------------ plugins/font/msd-font-manager.h | 61 ----- plugins/font/msd-font-plugin.c | 109 -------- plugins/font/msd-font-plugin.h | 63 ----- 9 files changed, 889 deletions(-) delete mode 100644 plugins/font/Makefile.am delete mode 100644 plugins/font/delayed-dialog.c delete mode 100644 plugins/font/delayed-dialog.h delete mode 100644 plugins/font/font.mate-settings-plugin.in delete mode 100644 plugins/font/msd-font-manager.c delete mode 100644 plugins/font/msd-font-manager.h delete mode 100644 plugins/font/msd-font-plugin.c delete mode 100644 plugins/font/msd-font-plugin.h (limited to 'plugins') diff --git a/plugins/Makefile.am b/plugins/Makefile.am index f1f227c..4741ba6 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -6,7 +6,6 @@ enabled_plugins = \ clipboard \ datetime \ dummy \ - font \ housekeeping \ keyboard \ media-keys \ diff --git a/plugins/font/Makefile.am b/plugins/font/Makefile.am deleted file mode 100644 index d0cf9ce..0000000 --- a/plugins/font/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -NULL = - -plugin_LTLIBRARIES = \ - libfont.la \ - $(NULL) - -libfont_la_SOURCES = \ - msd-font-plugin.h \ - msd-font-plugin.c \ - msd-font-manager.h \ - msd-font-manager.c \ - delayed-dialog.h \ - delayed-dialog.c \ - $(NULL) - -libfont_la_CPPFLAGS = \ - -I$(top_srcdir)/mate-settings-daemon \ - -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ - $(AM_CPPFLAGS) - -libfont_la_CFLAGS = \ - $(SETTINGS_PLUGIN_CFLAGS) \ - $(AM_CFLAGS) - -libfont_la_LDFLAGS = \ - $(MSD_PLUGIN_LDFLAGS) \ - $(NULL) - -libfont_la_LIBADD = \ - $(SETTINGS_PLUGIN_LIBS) \ - $(NULL) - -plugin_in_files = \ - font.mate-settings-plugin.in \ - $(NULL) - -plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin) - -EXTRA_DIST = \ - $(plugin_in_files) \ - $(NULL) - -CLEANFILES = \ - $(plugin_DATA) \ - $(NULL) - -DISTCLEANFILES = \ - $(plugin_DATA) \ - $(NULL) - -@MSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/font/delayed-dialog.c b/plugins/font/delayed-dialog.c deleted file mode 100644 index afec416..0000000 --- a/plugins/font/delayed-dialog.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright © 2006 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2, or (at - * your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#include -#include - -#include -#include - -#include "delayed-dialog.h" - -static gboolean delayed_show_timeout (gpointer data); -static GdkFilterReturn message_filter (GdkXEvent *xevent, - GdkEvent *event, - gpointer data); - -static GSList *dialogs = NULL; - -/** - * mate_settings_delayed_show_dialog: - * @dialog: the dialog - * - * Shows the dialog as with gtk_widget_show(), unless a window manager - * hasn't been started yet, in which case it will wait up to 5 seconds - * for that to happen before showing the dialog. - **/ -void -mate_settings_delayed_show_dialog (GtkWidget *dialog) -{ - GdkDisplay *display = gtk_widget_get_display (dialog); - Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); - GdkScreen *screen = gtk_widget_get_screen (dialog); - GdkAtom manager_atom; - char selection_name[10]; - Atom selection_atom; - - /* We can't use gdk_selection_owner_get() for this, because - * it's an unknown out-of-process window. - */ - snprintf (selection_name, sizeof (selection_name), "WM_S%d", - gdk_screen_get_number (screen)); - selection_atom = XInternAtom (xdisplay, selection_name, True); - if (selection_atom && - XGetSelectionOwner (xdisplay, selection_atom) != None) { - gtk_widget_show (dialog); - return; - } - - dialogs = g_slist_prepend (dialogs, dialog); - - manager_atom = gdk_atom_intern ("MANAGER", FALSE); - gdk_display_add_client_message_filter (display, manager_atom, - message_filter, NULL); - - g_timeout_add (5000, delayed_show_timeout, NULL); -} - -static gboolean -delayed_show_timeout (gpointer data) -{ - GSList *l; - - for (l = dialogs; l; l = l->next) - gtk_widget_show (l->data); - g_slist_free (dialogs); - dialogs = NULL; - - /* FIXME: There's no gdk_display_remove_client_message_filter */ - - return FALSE; -} - -static GdkFilterReturn -message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) -{ - XClientMessageEvent *evt = (XClientMessageEvent *)xevent; - char *selection_name = XGetAtomName (evt->display, evt->data.l[1]); - int screen; - GSList *l, *next; - - if (!dialogs) - return GDK_FILTER_CONTINUE; - - if (strncmp (selection_name, "WM_S", 4) != 0) { - XFree (selection_name); - return GDK_FILTER_CONTINUE; - } - - screen = atoi (selection_name + 4); - - for (l = dialogs; l; l = next) { - GtkWidget *dialog = l->data; - next = l->next; - - if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) { - gtk_widget_show (dialog); - dialogs = g_slist_remove (dialogs, dialog); - } - } - - if (!dialogs) { - /* FIXME: There's no gdk_display_remove_client_message_filter */ - } - - return GDK_FILTER_CONTINUE; -} diff --git a/plugins/font/delayed-dialog.h b/plugins/font/delayed-dialog.h deleted file mode 100644 index 2bc2313..0000000 --- a/plugins/font/delayed-dialog.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright © 2006 Novell, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2, or (at - * your option) any later version. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - - -#ifndef __DELAYED_DIALOG_H -#define __DELAYED_DIALOG_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void mate_settings_delayed_show_dialog (GtkWidget *dialog); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/plugins/font/font.mate-settings-plugin.in b/plugins/font/font.mate-settings-plugin.in deleted file mode 100644 index 6bb1c47..0000000 --- a/plugins/font/font.mate-settings-plugin.in +++ /dev/null @@ -1,8 +0,0 @@ -[MATE Settings Plugin] -Module=font -IAge=0 -_Name=Font -_Description=Font plugin -Authors=Rodrigo Moya -Copyright=Copyright © 2007 The MATE Foundation -Website= diff --git a/plugins/font/msd-font-manager.c b/plugins/font/msd-font-manager.c deleted file mode 100644 index 46206b4..0000000 --- a/plugins/font/msd-font-manager.c +++ /dev/null @@ -1,438 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 The MATE Foundation - * Copyright (C) 2007 William Jon McCann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include - -#include "mate-settings-profile.h" -#include "msd-font-manager.h" -#include "delayed-dialog.h" - -static void msd_font_manager_class_init (MsdFontManagerClass *klass); -static void msd_font_manager_init (MsdFontManager *font_manager); - -G_DEFINE_TYPE (MsdFontManager, msd_font_manager, G_TYPE_OBJECT) - -static gpointer manager_object = NULL; - -static void -update_property (GString *props, const gchar* key, const gchar* value) -{ - gchar* needle; - size_t needle_len; - gchar* found = NULL; - - /* update an existing property */ - needle = g_strconcat (key, ":", NULL); - needle_len = strlen (needle); - if (g_str_has_prefix (props->str, needle)) - found = props->str; - else - found = strstr (props->str, needle); - - if (found) { - size_t value_index; - gchar* end; - - end = strchr (found, '\n'); - value_index = (found - props->str) + needle_len + 1; - g_string_erase (props, value_index, end ? (end - found - needle_len) : -1); - g_string_insert (props, value_index, "\n"); - g_string_insert (props, value_index, value); - } else { - g_string_append_printf (props, "%s:\t%s\n", key, value); - } -} - -static void -load_xcursor_theme (GSettings *settings) -{ - char *cursor_theme; - int size; - GString *add_string; - Display *dpy; - gchar numbuf[20]; - - mate_settings_profile_start (NULL); - - size = g_settings_get_int (settings, "cursor-size"); - if (size <= 0) { - return; - } - - cursor_theme = g_settings_get_string (settings, "cursor-theme"); - if (cursor_theme == NULL) { - return; - } - - /* get existing properties */ - dpy = XOpenDisplay (NULL); - g_return_if_fail (dpy != NULL); - add_string = g_string_new (XResourceManagerString (dpy)); - g_debug("load_xcursor_theme: existing res '%s'", add_string->str); - - update_property (add_string, "Xcursor.theme", cursor_theme); - update_property (add_string, "Xcursor.theme_core", "true"); - g_snprintf (numbuf, sizeof (numbuf), "%i", size); - update_property (add_string, "Xcursor.size", numbuf); - - g_debug("load_xcursor_theme: new res '%s'", add_string->str); - - /* Set the new X property */ - XChangeProperty(dpy, RootWindow (dpy, 0), - XA_RESOURCE_MANAGER, XA_STRING, 8, PropModeReplace, add_string->str, add_string->len); - XCloseDisplay (dpy); - - g_free (cursor_theme); - g_string_free (add_string, TRUE); - - mate_settings_profile_end (NULL); -} - -static char* setup_dir(const char* font_dir_name, gboolean create) -{ - #if GLIB_CHECK_VERSION(2, 6, 0) - char* font_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), "mate", "share", font_dir_name, NULL); - #else // glib version < 2.6.0 - char* font_dir = g_build_path(G_DIR_SEPARATOR_S, g_get_home_dir(), ".config", "mate", "share", font_dir_name, NULL); - #endif - - if (create) - { - if (g_mkdir_with_parents(font_dir, 0755) != 0) - { - g_warning("Cannot create needed directory \"%s\".", font_dir); - g_free(font_dir); - font_dir = NULL; - } - } - else if (!g_file_test(font_dir, G_FILE_TEST_EXISTS)) - { - g_free (font_dir); - font_dir = NULL; - } - - return font_dir; -} - -static char * -empty_check_dir (char *font_dir) -{ - char *file_name; - - if (!font_dir) - return NULL; - - /* remove the fonts.dir and fonts.scale files that mkfontdir generates. */ - - file_name = g_build_filename (G_DIR_SEPARATOR_S, font_dir, "fonts.dir", NULL); - unlink (file_name); - g_free (file_name); - - file_name = g_build_filename (G_DIR_SEPARATOR_S, font_dir, "fonts.scale", NULL); - unlink (file_name); - g_free (file_name); - - /* if it's empty, get rid of it. */ - if (0 == rmdir (font_dir)) { - g_free (font_dir); - font_dir = NULL; - } - - return font_dir; -} - -static char* -setup_font_dir (GSettings *settings) -{ - return empty_check_dir (setup_dir ("fonts", FALSE)); -} - -static char* -setup_cursor_dir (GSettings *settings) -{ - char *cursor_dir; - char *cursor_font; - DIR *dir; - struct dirent *file_dirent; - - cursor_font = g_settings_get_string (settings, "cursor-font"); - if (cursor_font != NULL) { - if (!g_path_is_absolute (cursor_font) || - !g_file_test (cursor_font, G_FILE_TEST_IS_REGULAR)) { - /* font file is not usable */ - g_free (cursor_font); - cursor_font = NULL; - } - } - - cursor_dir = setup_dir ("cursor-fonts", cursor_font != NULL); - - /* remove previously made symlinks, if any */ - if (cursor_dir) { - dir = opendir (cursor_dir); - while ((file_dirent = readdir (dir)) != NULL) { - struct stat st; - char *link_name; - - link_name = g_build_filename (cursor_dir, file_dirent->d_name, NULL); - if (lstat (link_name, &st)) { - g_free (link_name); - continue; - } - g_free (link_name); - - if (S_ISLNK (st.st_mode)) - unlink (link_name); - } - closedir (dir); - } - - if (cursor_font && cursor_dir) { - char *newpath; - char *font_name; - - font_name = strrchr (cursor_font, G_DIR_SEPARATOR); - newpath = g_build_filename (cursor_dir, font_name, NULL); - symlink (cursor_font, newpath); - g_free (newpath); - g_free (cursor_font); - cursor_font = NULL; - } else { - cursor_dir = empty_check_dir (cursor_dir); - } - - return cursor_dir; -} - -static void -load_font_paths (GSettings *settings) -{ - char *font_dir_name; - char *cursor_dir_name; - - char **font_path; - char **new_font_path; - int n_fonts; - int new_n_fonts; - - int i; - - const char *argv[4]; - int argc = 0; - - mate_settings_profile_start (NULL); - - font_dir_name = setup_font_dir (settings); - cursor_dir_name = setup_cursor_dir (settings); - - if (font_dir_name == NULL && cursor_dir_name == NULL) - goto done; - - /* run mkfontdir */ - argv[argc++] = "mkfontdir"; - if (font_dir_name) - argv[argc++] = font_dir_name; - if (cursor_dir_name) - argv[argc++] = cursor_dir_name; - argv[argc] = NULL; - g_spawn_sync (NULL, /* current dir */ - (char **) (void *) argv, NULL /* envp */, - G_SPAWN_SEARCH_PATH, - NULL, NULL, /* child_setup */ - NULL, NULL, NULL, NULL); - - /* Set the font path */ - font_path = XGetFontPath (gdk_x11_get_default_xdisplay (), &n_fonts); - new_n_fonts = n_fonts; - if (cursor_dir_name && (n_fonts == 0 || strcmp (font_path[0], cursor_dir_name))) - new_n_fonts++; - if (font_dir_name && (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))) - new_n_fonts++; - - if (new_n_fonts == n_fonts) - new_font_path = font_path; - else { - new_font_path = g_new0 (char *, new_n_fonts); - - if (cursor_dir_name && (n_fonts == 0 || strcmp (font_path[0], cursor_dir_name))) { - new_font_path[0] = cursor_dir_name; - for (i = 0; i < n_fonts; i++) - new_font_path [i+1] = font_path [i]; - } else { - for (i = 0; i < n_fonts; i++) - new_font_path [i] = font_path [i]; - } - - if (font_dir_name && (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))) { - new_font_path[new_n_fonts-1] = font_dir_name; - } - } - - /* We set font path even if it was not changed, to enforce dropping - * caches in the server */ - gdk_error_trap_push (); - XSetFontPath (gdk_display, new_font_path, new_n_fonts); - gdk_flush (); - - /* if there was an error setting the new path, revert */ - if (gdk_error_trap_pop ()) { - XSetFontPath (gdk_display, font_path, n_fonts); - } - - g_free (font_dir_name); - g_free (cursor_dir_name); - - if (new_font_path != font_path) - g_free (new_font_path); - - XFreeFontPath (font_path); - -done: - mate_settings_profile_end (NULL); -} - -gboolean -msd_font_manager_start (MsdFontManager *manager, - GError **error) -{ - GSettings *settings; - - g_debug ("Starting font manager"); - mate_settings_profile_start (NULL); - - settings = g_settings_new ("org.mate.peripherals-mouse"); - - load_xcursor_theme (settings); - load_font_paths (settings); - - g_object_unref (settings); - - mate_settings_profile_end (NULL); - - return TRUE; -} - -void -msd_font_manager_stop (MsdFontManager *manager) -{ - g_debug ("Stopping font manager"); -} - -static void -msd_font_manager_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - MsdFontManager *self; - - self = MSD_FONT_MANAGER (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -msd_font_manager_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - MsdFontManager *self; - - self = MSD_FONT_MANAGER (object); - - switch (prop_id) { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static GObject * -msd_font_manager_constructor (GType type, - guint n_construct_properties, - GObjectConstructParam *construct_properties) -{ - MsdFontManager *font_manager; - MsdFontManagerClass *klass; - - klass = MSD_FONT_MANAGER_CLASS (g_type_class_peek (MSD_TYPE_FONT_MANAGER)); - - font_manager = MSD_FONT_MANAGER (G_OBJECT_CLASS (msd_font_manager_parent_class)->constructor (type, - n_construct_properties, - construct_properties)); - - return G_OBJECT (font_manager); -} - -static void -msd_font_manager_class_init (MsdFontManagerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->get_property = msd_font_manager_get_property; - object_class->set_property = msd_font_manager_set_property; - object_class->constructor = msd_font_manager_constructor; -} - -static void -msd_font_manager_init (MsdFontManager *manager) -{ -} - -MsdFontManager * -msd_font_manager_new (void) -{ - if (manager_object != NULL) { - g_object_ref (manager_object); - } else { - manager_object = g_object_new (MSD_TYPE_FONT_MANAGER, NULL); - g_object_add_weak_pointer (manager_object, - (gpointer *) &manager_object); - } - - return MSD_FONT_MANAGER (manager_object); -} diff --git a/plugins/font/msd-font-manager.h b/plugins/font/msd-font-manager.h deleted file mode 100644 index 6a87baf..0000000 --- a/plugins/font/msd-font-manager.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef __MSD_FONT_MANAGER_H -#define __MSD_FONT_MANAGER_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define MSD_TYPE_FONT_MANAGER (msd_font_manager_get_type ()) -#define MSD_FONT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_FONT_MANAGER, MsdFontManager)) -#define MSD_FONT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_FONT_MANAGER, MsdFontManagerClass)) -#define MSD_IS_FONT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_FONT_MANAGER)) -#define MSD_IS_FONT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_FONT_MANAGER)) -#define MSD_FONT_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_FONT_MANAGER, MsdFontManagerClass)) - -typedef struct MsdFontManagerPrivate MsdFontManagerPrivate; - -typedef struct -{ - GObject parent; - MsdFontManagerPrivate *priv; -} MsdFontManager; - -typedef struct -{ - GObjectClass parent_class; -} MsdFontManagerClass; - -GType msd_font_manager_get_type (void); - -MsdFontManager * msd_font_manager_new (void); -gboolean msd_font_manager_start (MsdFontManager *manager, - GError **error); -void msd_font_manager_stop (MsdFontManager *manager); - -#ifdef __cplusplus -} -#endif - -#endif /* __MSD_FONT_MANAGER_H */ diff --git a/plugins/font/msd-font-plugin.c b/plugins/font/msd-font-plugin.c deleted file mode 100644 index d76aabb..0000000 --- a/plugins/font/msd-font-plugin.c +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include -#include - -#include "mate-settings-plugin.h" -#include "msd-font-plugin.h" -#include "msd-font-manager.h" - -struct MsdFontPluginPrivate { - MsdFontManager *manager; -}; - -#define MSD_FONT_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), MSD_TYPE_FONT_PLUGIN, MsdFontPluginPrivate)) - -MATE_SETTINGS_PLUGIN_REGISTER (MsdFontPlugin, msd_font_plugin) - -static void -msd_font_plugin_init (MsdFontPlugin *plugin) -{ - plugin->priv = MSD_FONT_PLUGIN_GET_PRIVATE (plugin); - - g_debug ("MsdFontPlugin initializing"); - - plugin->priv->manager = msd_font_manager_new (); -} - -static void -msd_font_plugin_finalize (GObject *object) -{ - MsdFontPlugin *plugin; - - g_return_if_fail (object != NULL); - g_return_if_fail (MSD_IS_FONT_PLUGIN (object)); - - g_debug ("MsdFontPlugin finalizing"); - - plugin = MSD_FONT_PLUGIN (object); - - g_return_if_fail (plugin->priv != NULL); - - if (plugin->priv->manager != NULL) { - g_object_unref (plugin->priv->manager); - } - - G_OBJECT_CLASS (msd_font_plugin_parent_class)->finalize (object); -} - -static void -impl_activate (MateSettingsPlugin *plugin) -{ - gboolean res; - GError *error; - - g_debug ("Activating font plugin"); - - error = NULL; - res = msd_font_manager_start (MSD_FONT_PLUGIN (plugin)->priv->manager, &error); - if (! res) { - g_warning ("Unable to start font manager: %s", error->message); - g_error_free (error); - } -} - -static void -impl_deactivate (MateSettingsPlugin *plugin) -{ - g_debug ("Deactivating font plugin"); - msd_font_manager_stop (MSD_FONT_PLUGIN (plugin)->priv->manager); -} - -static void -msd_font_plugin_class_init (MsdFontPluginClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass); - - object_class->finalize = msd_font_plugin_finalize; - - plugin_class->activate = impl_activate; - plugin_class->deactivate = impl_deactivate; - - g_type_class_add_private (klass, sizeof (MsdFontPluginPrivate)); -} - -static void -msd_font_plugin_class_finalize (MsdFontPluginClass *klass) -{ -} diff --git a/plugins/font/msd-font-plugin.h b/plugins/font/msd-font-plugin.h deleted file mode 100644 index ea6e775..0000000 --- a/plugins/font/msd-font-plugin.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef __MSD_FONT_PLUGIN_H__ -#define __MSD_FONT_PLUGIN_H__ - -#include -#include -#include - -#include "mate-settings-plugin.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define MSD_TYPE_FONT_PLUGIN (msd_font_plugin_get_type ()) -#define MSD_FONT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MSD_TYPE_FONT_PLUGIN, MsdFontPlugin)) -#define MSD_FONT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MSD_TYPE_FONT_PLUGIN, MsdFontPluginClass)) -#define MSD_IS_FONT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MSD_TYPE_FONT_PLUGIN)) -#define MSD_IS_FONT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MSD_TYPE_FONT_PLUGIN)) -#define MSD_FONT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MSD_TYPE_FONT_PLUGIN, MsdFontPluginClass)) - -typedef struct MsdFontPluginPrivate MsdFontPluginPrivate; - -typedef struct -{ - MateSettingsPlugin parent; - MsdFontPluginPrivate *priv; -} MsdFontPlugin; - -typedef struct -{ - MateSettingsPluginClass parent_class; -} MsdFontPluginClass; - -GType msd_font_plugin_get_type (void) G_GNUC_CONST; - -/* All the plugins must implement this function */ -G_MODULE_EXPORT GType register_mate_settings_plugin (GTypeModule *module); - -#ifdef __cplusplus -} -#endif - -#endif /* __MSD_FONT_PLUGIN_H__ */ -- cgit v1.2.1