Index: xfprint/main.c =================================================================== --- xfprint/main.c (revision 27023) +++ xfprint/main.c (working copy) @@ -32,14 +32,14 @@ #include #include -#include +#include #include #include #include #include "print_dialog.h" -#define CHANNEL "xfprint" +#define CHANNEL "xfprint" extern void print_dialog_run (const gchar * ifile); @@ -48,7 +48,7 @@ { gchar *ifile = NULL; gchar *decoded_ifile = NULL; - McsClient *client; + XfconfChannel *channel; Display *dpy; int screen; PrintingSystem *ps = NULL; @@ -61,32 +61,26 @@ gtk_set_locale (); gtk_init (&argc, &argv); + xfconf_init(NULL); + /* Load the printing system module */ dpy = GDK_DISPLAY (); screen = XDefaultScreen (dpy); - if (!mcs_client_check_manager (dpy, screen, "xfce-mcs-manager")) - g_warning ("%s: mcs manager not running\n", PACKAGE); - client = mcs_client_new (dpy, screen, NULL, NULL, NULL); - if (client) { - McsSetting *setting; + channel = xfconf_channel_new (CHANNEL); + if (channel) { - mcs_client_add_channel (client, CHANNEL); - - if (mcs_client_get_setting (client, "XfPrint/system", CHANNEL, &setting) == MCS_SUCCESS) { - if (g_ascii_strcasecmp (setting->data.v_string, "none") != 0) { - ps = printing_system_new (setting->data.v_string); - if (ps == NULL) - g_warning ("Unable to load printing system module %s", setting->data.v_string); + if (xfconf_channel_has_property (channel, "/XfPrint/system")) { + const gchar *system_name = xfconf_channel_get_string (channel, "/XfPrint/system", "none"); + if (g_ascii_strcasecmp (system_name, "none") != 0) { + ps = printing_system_new (system_name); + if (ps == NULL); + g_warning ("Unable to load printing system module %s", system_name); } - mcs_setting_free (setting); } else { g_warning ("%s: XfPrint/system is not set", PACKAGE); } - mcs_client_destroy (client); - } else { - g_warning ("%s: no mcs client found", PACKAGE); } if (ps == NULL) @@ -171,5 +165,7 @@ g_free (decoded_ifile); g_free (ifile); + xfconf_shutdown(); + return (EXIT_SUCCESS); } Index: xfprint/Makefile.am =================================================================== --- xfprint/Makefile.am (revision 27023) +++ xfprint/Makefile.am (working copy) @@ -33,7 +33,7 @@ -I$(top_srcdir)/libxfprint \ -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ -DPLUGIN_DIR=\"${libdir}/xfce4/xfprint-plugins\" \ - @LIBXFCE4MCS_CLIENT_CFLAGS@ \ + @XFCONF_CFLAGS@ \ @LIBXFCEGUI4_CFLAGS@ xfprint4_LDFLAGS = \ @@ -41,7 +41,7 @@ xfprint4_LDADD = \ $(top_builddir)/libxfprint/libxfprint.la \ - @LIBXFCE4MCS_CLIENT_LIBS@ \ + @XFCONF_LIBS@ \ @LIBXFCEGUI4_LIBS@ xfprint4_DEPENDENCIES = \ Index: configure.in.in =================================================================== --- configure.in.in (revision 27023) +++ configure.in.in (working copy) @@ -14,7 +14,7 @@ dnl version info m4_define([xfprint_version_major], [4]) -m4_define([xfprint_version_minor], [4]) +m4_define([xfprint_version_minor], [5]) m4_define([xfprint_version_micro], [0]) m4_define([xfprint_version_nano], []) m4_define([xfprint_version_build], [@REVISION@]) @@ -23,7 +23,7 @@ dnl minimum required versions m4_define([gtk_minimum_version], [2.6.0]) -m4_define([xfce_minimum_version], [4.4.0]) +m4_define([xfce_minimum_version], [4.5.0]) dnl # DO NOT MODIFY ANYTHING BELOW THIS LINE, UNLESS YOU KNOW WHAT dnl # YOU ARE DOING. @@ -97,10 +97,8 @@ dnl Check for libxfce4uti XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [xfce_minimum_version]) -dnl Check for libxfce4mcs -XDT_CHECK_PACKAGE(LIBXFCE4MCS_CLIENT, libxfce4mcs-client-1.0, [xfce_minimum_version]) -XDT_CHECK_PACKAGE(LIBXFCE4MCS_MANAGER, libxfce4mcs-manager-1.0, [xfce_minimum_version]) -XDT_XFCE_MCS_PLUGIN([XFCE_MCS_MANAGER], [xfce_minimum_version]) +dnl Check for xfconf +XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [0]) dnl Check for CUPS AC_ARG_ENABLE([cups], Index: xfprint-manager/main.c =================================================================== --- xfprint-manager/main.c (revision 27023) +++ xfprint-manager/main.c (working copy) @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include @@ -47,7 +47,7 @@ int main (int argc, char **argv) { - McsClient *client; + XfconfChannel *channel; Display *dpy; int screen; PrintingSystem *ps = NULL; @@ -56,29 +56,26 @@ gtk_set_locale (); gtk_init (&argc, &argv); + + xfconf_init (NULL); /* Load the printing system module */ dpy = GDK_DISPLAY (); screen = XDefaultScreen (dpy); - if (!mcs_client_check_manager (dpy, screen, "xfce-mcs-manager")) - g_warning ("%s: mcs manager not running\n", PACKAGE); - client = mcs_client_new (dpy, screen, NULL, NULL, NULL); - if (client) { - McsSetting *setting; + channel = xfconf_channel_new (CHANNEL); + if (channel) { - mcs_client_add_channel (client, CHANNEL); - - if (mcs_client_get_setting (client, "XfPrint/system", CHANNEL, &setting) == MCS_SUCCESS) { - if (g_ascii_strcasecmp (setting->data.v_string, "none") != 0) { - ps = printing_system_new (setting->data.v_string); - if (ps == NULL) - g_warning ("Unable to load printing system module %s", setting->data.v_string); + if (xfconf_channel_has_property (channel, "/XfPrint/system")) { + const gchar *system_name = xfconf_channel_get_string (channel, "/XfPrint/system", "none"); + if (g_ascii_strcasecmp (system_name, "none") != 0) { + ps = printing_system_new (system_name); + if (ps == NULL); + g_warning ("Unable to load printing system module %s", system_name); } - mcs_setting_free (setting); + } else { + g_warning ("%s: XfPrint/system is not set", PACKAGE); } - - mcs_client_destroy (client); } if (argc > 1 && (!strcmp (argv[1], "--version") || !strcmp (argv[1], "-V"))) { @@ -109,5 +106,7 @@ gtk_main (); } + xfconf_shutdown(); + return (EXIT_SUCCESS); } Index: xfprint-manager/Makefile.am =================================================================== --- xfprint-manager/Makefile.am (revision 27023) +++ xfprint-manager/Makefile.am (working copy) @@ -18,7 +18,7 @@ -I$(top_srcdir)/libxfprint \ -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ -DPLUGIN_DIR=\"${libdir}/xfce4/xfprint-plugins\" \ - @LIBXFCE4MCS_CLIENT_CFLAGS@ \ + @XFCONF_CFLAGS@ \ @LIBXFCEGUI4_CFLAGS@ xfprint4_manager_LDFLAGS = \ @@ -26,7 +26,7 @@ xfprint4_manager_LDADD = \ $(top_builddir)/libxfprint/libxfprint.la \ - @LIBXFCE4MCS_CLIENT_LIBS@ \ + @XFCONF_LIBS@ \ @LIBXFCEGUI4_LIBS@ appsdir = $(datadir)/applications Index: INSTALL =================================================================== --- INSTALL (revision 27023) +++ INSTALL (working copy) @@ -1,8 +1,8 @@ Installation Instructions ************************* -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free -Software Foundation, Inc. +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, +2006, 2007 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. @@ -10,7 +10,10 @@ Basic Installation ================== -These are generic installation instructions. +Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -23,9 +26,9 @@ It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. (Caching is +the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale -cache files.) +cache files. If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail @@ -35,20 +38,17 @@ may remove or edit it. The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You only need -`configure.ac' if you want to change it or regenerate `configure' using -a newer version of `autoconf'. +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. + `./configure' to configure the package for your system. - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. 2. Type `make' to compile the package. @@ -67,6 +67,9 @@ all sorts of other programs in order to regenerate files that came with the distribution. + 6. Often, you can also type `make uninstall' to remove the installed + files again. + Compilers and Options ===================== @@ -78,7 +81,7 @@ by setting variables in the command line or in the environment. Here is an example: - ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. @@ -87,31 +90,29 @@ You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the +own directory. To do this, you can use GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. - If you have to use a `make' that does not support the `VPATH' -variable, you have to compile the package for one architecture at a -time in the source code directory. After you have installed the -package for one architecture, use `make distclean' before reconfiguring -for another architecture. + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. Installation Names ================== -By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular @@ -159,7 +160,7 @@ need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should -use the `--target=TYPE' option to select the type of system they will +use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a @@ -189,9 +190,14 @@ ./configure CC=/usr/local2/bin/gcc -will cause the specified gcc to be used as the C compiler (unless it is +causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf bug. Until the bug is fixed you can use this workaround: + + CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash + `configure' Invocation ====================== Index: mcs-plugin/xfprint-settings.desktop.in =================================================================== --- mcs-plugin/xfprint-settings.desktop.in (revision 26941) +++ mcs-plugin/xfprint-settings.desktop.in (working copy) @@ -2,7 +2,7 @@ Encoding=UTF-8 _Name=Xfce 4 Printing System Settings _Comment=Allow you to select the printing system backend that xfprint will use -Exec=xfce-setting-show printing_system +Exec=xfprint-settings Icon=printer Terminal=false Type=Application Index: mcs-plugin/xfce-xfprint-settings.desktop.in =================================================================== --- mcs-plugin/xfce-xfprint-settings.desktop.in (revision 27023) +++ mcs-plugin/xfce-xfprint-settings.desktop.in (working copy) @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -_Name=Xfce 4 Printing System Settings -_Comment=Allow you to select the printing system backend that xfprint will use -Exec=xfce-setting-show printing_system -Icon=printer -Terminal=false -Type=Application -Categories=X-XFCE;Settings;DesktopSettings; -OnlyShowIn=XFCE; -_GenericName=Printing System Settings Index: mcs-plugin/Makefile.am =================================================================== --- mcs-plugin/Makefile.am (revision 27023) +++ mcs-plugin/Makefile.am (working copy) @@ -1,31 +1,24 @@ -xfprint_plugindir = $(libdir)/xfce4/mcs-plugins +bin_PROGRAMS = xfprint-settings -xfprint_plugin_LTLIBRARIES = xfprint_plugin.la - -xfprint_plugin_la_LDFLAGS = \ - -avoid-version \ - -module - -xfprint_plugin_la_SOURCES = \ +xfprint_settings_SOURCES = \ xfprint_plugin.c -xfprint_plugin_la_CFLAGS = \ - -I$(top_srcdir) \ +xfprint_settings_CFLAGS = \ + -I$(top_srcdir) \ -I$(top_srcdir)/libxfprint \ - @LIBXFCE4MCS_MANAGER_CFLAGS@ \ @LIBXFCEGUI4_CFLAGS@ \ - @XFCE_MCS_MANAGER_CFLAGS@ \ + @XFCONF_CFLAGS@ \ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ -DPLUGIN_DIR=\"${libdir}/xfce4/xfprint-plugins\" \ -DSYSCONFDIR=\"$(sysconfdir)\" -xfprint_plugin_la_LIBADD = \ +xfprint_settings_LDADD = \ $(top_builddir)/libxfprint/libxfprint.la \ @LIBXFCEGUI4_LIBS@ \ - @LIBXFCE4MCS_MANAGER_LIBS@ + @XFCONF_LIBS@ appsdir = $(datadir)/applications -apps_in_files = xfce-xfprint-settings.desktop.in +apps_in_files = xfprint-settings.desktop.in apps_DATA = $(apps_in_files:.desktop.in=.desktop) @INTLTOOL_DESKTOP_RULE@ Index: mcs-plugin/xfprint_plugin.c =================================================================== --- mcs-plugin/xfprint_plugin.c (revision 27023) +++ mcs-plugin/xfprint_plugin.c (working copy) @@ -25,17 +25,13 @@ #endif /* */ -#include +#include #include -#include #include /* */ -#define RCDIR "mcs_settings" -#define OLD_RCDIR "settings" #define CHANNEL "xfprint" -#define RCFILE "xfprint.xml" #define SOEXT ("." G_MODULE_SUFFIX) #define SOEXT_LEN (strlen (SOEXT)) @@ -56,9 +52,9 @@ /* setting */ static gchar *printing_system = NULL; +static XfconfChannel *channel = NULL; /* */ -static GtkWidget *dialog = NULL; static GtkWidget *treeview; static GtkWidget *label_description; static GtkWidget *label_version; @@ -67,97 +63,52 @@ /* static prototypes */ -static void run_dialog (McsPlugin *); -static gboolean save_settings (McsPlugin *); +static GtkWidget *create_settings_dialog(); /* */ -McsPluginInitResult -mcs_plugin_init (McsPlugin * plugin) +int +main (int argc, char **argv) { - McsSetting *setting; gchar *file, *path, *s; xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); - /* read settings channel from file */ - path = g_build_filename ("xfce4", RCDIR, RCFILE, NULL); - file = xfce_resource_lookup (XFCE_RESOURCE_CONFIG, path); - g_free (path); + gtk_init (&argc, &argv); - if (!file) - file = xfce_get_userfile (OLD_RCDIR, RCFILE, NULL); + xfconf_init(NULL); - if (g_file_test (file, G_FILE_TEST_EXISTS)) { - mcs_manager_add_channel_from_file (plugin->manager, CHANNEL, file); - } - else { - mcs_manager_add_channel (plugin->manager, CHANNEL); - } + channel = xfconf_channel_new (CHANNEL); - g_free (file); - - if ((setting = mcs_manager_setting_lookup (plugin->manager, "XfPrint/system", CHANNEL)) != NULL) { - if ((s = strrchr (setting->data.v_string, G_DIR_SEPARATOR))) { + if (xfconf_channel_has_property (channel, "/XfPrint/system")) { + const gchar *system_name = xfconf_channel_get_string (channel, "/XfPrint/system", "none"); + if ((s = strrchr (system_name, G_DIR_SEPARATOR))) { g_message ("xfprint: full path module, using basename: %s", ++s); printing_system = g_strdup (s); } else - printing_system = g_strdup (setting->data.v_string); + printing_system = g_strdup (system_name); } else { printing_system = g_strdup ("none"); - mcs_manager_set_string (plugin->manager, "XfPrint/system", CHANNEL, printing_system); + xfconf_channel_set_string (channel, "/XfPrint/system", printing_system); } - plugin->plugin_name = g_strdup ("printing_system"); - plugin->caption = g_strdup (_("Printing system")); - plugin->run_dialog = run_dialog; - plugin->icon = xfce_themed_icon_load ("printer", 48); - if (G_LIKELY (plugin->icon != NULL)) - g_object_set_data_full (G_OBJECT (plugin->icon), "mcs-plugin-icon-name", g_strdup ("printer"), g_free); - mcs_manager_notify (plugin->manager, CHANNEL); + GtkWidget *dialog = create_settings_dialog(); + + gtk_dialog_run (GTK_DIALOG(dialog)); - return (MCS_PLUGIN_INIT_OK); -} + xfconf_shutdown(); - -static gboolean -save_settings (McsPlugin * plugin) -{ - gboolean result; - gchar *file, *path; - - path = g_build_filename ("xfce4", RCDIR, RCFILE, NULL); - file = xfce_resource_save_location (XFCE_RESOURCE_CONFIG, path, TRUE); - - result = mcs_manager_save_channel_to_file (plugin->manager, CHANNEL, file); - g_free (path); - g_free (file); - - return (result); + return 0; } -/* Callbacks */ -static gboolean -cb_dialog_response (void) -{ - if (dialog != NULL) { - gtk_widget_destroy (dialog); - dialog = NULL; - } - return TRUE; -} - static void cb_selection_changed (GtkTreeSelection * selection, gpointer data) { GtkTreeModel *model; GtkTreeIter iter; - McsPlugin *plugin; - - plugin = (McsPlugin *) data; - + if (gtk_tree_selection_get_selected (selection, &model, &iter)) { gchar *description = NULL; gchar *version = NULL; @@ -165,10 +116,12 @@ gchar *homepage = NULL; gchar *path = NULL; + gtk_tree_model_get (model, &iter, COLUMN_DESCRIPTION, &description, COLUMN_VERSION, &version, COLUMN_AUTHOR, &author, COLUMN_HOMEPAGE, &homepage, COLUMN_PATH, &path, -1); + if (description) gtk_label_set_text (GTK_LABEL (label_description), description); if (version) @@ -181,10 +134,8 @@ g_free (printing_system); printing_system = g_strdup (path); - mcs_manager_set_string (plugin->manager, "XfPrint/system", CHANNEL, printing_system); - mcs_manager_notify (plugin->manager, CHANNEL); - save_settings (plugin); - + xfconf_channel_set_string (channel, "/XfPrint/system", printing_system); + g_free (path); g_free (homepage); g_free (author); @@ -194,9 +145,10 @@ } /* */ -static void -run_dialog (McsPlugin * plugin) +static GtkWidget * +create_settings_dialog () { + GtkWidget *dialog; GtkWidget *hbox; GtkWidget *swin; GtkListStore *store; @@ -215,21 +167,10 @@ const char *file; GtkTreeSelection *selection; - if (dialog != NULL) { - gtk_window_present (GTK_WINDOW (dialog)); - return; - } - - xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); - dialog = xfce_titled_dialog_new_with_buttons (_("Printing System Selection"), NULL, GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); gtk_window_set_icon_name (GTK_WINDOW (dialog), "printer"); - /* Connect callbacks */ - g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (cb_dialog_response), NULL); - g_signal_connect (G_OBJECT (dialog), "delete-event", G_CALLBACK (cb_dialog_response), NULL); - hbox = gtk_hbox_new (FALSE, BORDER); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, BORDER); gtk_container_set_border_width (GTK_CONTAINER (hbox), BORDER - 1); @@ -314,7 +255,7 @@ /* handle selection */ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (cb_selection_changed), plugin); + g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (cb_selection_changed), channel); /* Initialize printing system list */ model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); @@ -381,7 +322,6 @@ xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (dialog)); gtk_widget_show_all (dialog); + return dialog; } -/* */ -MCS_PLUGIN_CHECK_INIT