[Xfce4-commits] r27040 - in xfprint/trunk: . mcs-plugin xfprint xfprint-manager
Stephan Arts
stephan at xfce.org
Thu Jun 5 23:34:57 CEST 2008
Author: stephan
Date: 2008-06-05 21:34:57 +0000 (Thu, 05 Jun 2008)
New Revision: 27040
Added:
xfprint/trunk/mcs-plugin/xfprint-settings.desktop.in
Removed:
xfprint/trunk/INSTALL
xfprint/trunk/mcs-plugin/xfce-xfprint-settings.desktop.in
Modified:
xfprint/trunk/configure.in.in
xfprint/trunk/mcs-plugin/Makefile.am
xfprint/trunk/mcs-plugin/xfprint_plugin.c
xfprint/trunk/xfprint-manager/Makefile.am
xfprint/trunk/xfprint-manager/main.c
xfprint/trunk/xfprint/Makefile.am
xfprint/trunk/xfprint/main.c
Log:
Applied patch to remove mcs dependency.
Remove autogenerated INSTALL file from repos.
Make settings-dialog stand-alone apps.
Deleted: xfprint/trunk/INSTALL
Modified: xfprint/trunk/configure.in.in
===================================================================
--- xfprint/trunk/configure.in.in 2008-06-05 21:30:21 UTC (rev 27039)
+++ xfprint/trunk/configure.in.in 2008-06-05 21:34:57 UTC (rev 27040)
@@ -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],
Modified: xfprint/trunk/mcs-plugin/Makefile.am
===================================================================
--- xfprint/trunk/mcs-plugin/Makefile.am 2008-06-05 21:30:21 UTC (rev 27039)
+++ xfprint/trunk/mcs-plugin/Makefile.am 2008-06-05 21:34:57 UTC (rev 27040)
@@ -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@
Deleted: xfprint/trunk/mcs-plugin/xfce-xfprint-settings.desktop.in
Copied: xfprint/trunk/mcs-plugin/xfprint-settings.desktop.in (from rev 27037, xfprint/trunk/mcs-plugin/xfce-xfprint-settings.desktop.in)
===================================================================
--- xfprint/trunk/mcs-plugin/xfprint-settings.desktop.in (rev 0)
+++ xfprint/trunk/mcs-plugin/xfprint-settings.desktop.in 2008-06-05 21:34:57 UTC (rev 27040)
@@ -0,0 +1,11 @@
+[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=xfprint-settings
+Icon=printer
+Terminal=false
+Type=Application
+Categories=X-XFCE;Settings;DesktopSettings;
+OnlyShowIn=XFCE;
+_GenericName=Printing System Settings
Modified: xfprint/trunk/mcs-plugin/xfprint_plugin.c
===================================================================
--- xfprint/trunk/mcs-plugin/xfprint_plugin.c 2008-06-05 21:30:21 UTC (rev 27039)
+++ xfprint/trunk/mcs-plugin/xfprint_plugin.c 2008-06-05 21:34:57 UTC (rev 27040)
@@ -25,17 +25,13 @@
#endif
/* */
-#include <libxfce4mcs/mcs-manager.h>
+#include <xfconf/xfconf.h>
#include <libxfcegui4/libxfcegui4.h>
-#include <xfce-mcs-manager/manager-plugin.h>
#include <printing-system.h>
/* */
-#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
Modified: xfprint/trunk/xfprint/Makefile.am
===================================================================
--- xfprint/trunk/xfprint/Makefile.am 2008-06-05 21:30:21 UTC (rev 27039)
+++ xfprint/trunk/xfprint/Makefile.am 2008-06-05 21:34:57 UTC (rev 27040)
@@ -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 = \
Modified: xfprint/trunk/xfprint/main.c
===================================================================
--- xfprint/trunk/xfprint/main.c 2008-06-05 21:30:21 UTC (rev 27039)
+++ xfprint/trunk/xfprint/main.c 2008-06-05 21:34:57 UTC (rev 27040)
@@ -32,14 +32,14 @@
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <libxfce4mcs/mcs-client.h>
+#include <xfconf/xfconf.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfcegui4/libxfcegui4.h>
#include <printing-system.h>
#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);
}
Modified: xfprint/trunk/xfprint-manager/Makefile.am
===================================================================
--- xfprint/trunk/xfprint-manager/Makefile.am 2008-06-05 21:30:21 UTC (rev 27039)
+++ xfprint/trunk/xfprint-manager/Makefile.am 2008-06-05 21:34:57 UTC (rev 27040)
@@ -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
Modified: xfprint/trunk/xfprint-manager/main.c
===================================================================
--- xfprint/trunk/xfprint-manager/main.c 2008-06-05 21:30:21 UTC (rev 27039)
+++ xfprint/trunk/xfprint-manager/main.c 2008-06-05 21:34:57 UTC (rev 27040)
@@ -33,7 +33,7 @@
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
-#include <libxfce4mcs/mcs-client.h>
+#include <xfconf/xfconf.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfcegui4/dialogs.h>
@@ -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);
}
More information about the Xfce4-commits
mailing list