/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* Evolution addressbook - Address Conduit Capplet * * Copyright (C) 1998 Free Software Foundation * Copyright (C) 2000 Helix Code, Inc. * * Authors: Eskil Heyn Olsen * JP Rosevear * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include #include #define ADDR_CONFIG_LOAD 1 #define ADDR_CONFIG_SAVE 1 #define ADDR_CONFIG_DUPE 1 #define ADDR_CONFIG_DESTROY 1 #include #undef ADDR_CONFIG_LOAD #undef ADDR_CONFIG_SAVE #undef ADDR_CONFIG_DUPE #undef ADDR_CONFIG_DESTROY /* tell changes callbacks to ignore changes or not */ static gboolean ignore_changes=FALSE; /* capplet widget */ static GtkWidget *capplet=NULL; /* host/device/pilot configuration windows */ GtkWidget *cfgOptionsWindow=NULL; GtkWidget *cfgStateWindow=NULL; GtkWidget *dialogWindow=NULL; gboolean activated,org_activation_state; GnomePilotConduitManagement *conduit; GnomePilotConduitConfig *conduit_config; EAddrConduitCfg *origState = NULL; EAddrConduitCfg *curState = NULL; static void doTrySettings(GtkWidget *widget, EAddrConduitCfg *c); static void doRevertSettings(GtkWidget *widget, EAddrConduitCfg *c); static void doSaveSettings(GtkWidget *widget, EAddrConduitCfg *c); static void setStateCfg (GtkWidget *w, EAddrConduitCfg *c); gint pilotId; static GnomePilotClient *gpc; /* This array must be in the same order as enumerations in GnomePilotConduitSyncType as they are used as index. Custom type implies Disabled state. */ static gchar* sync_options[] ={ N_("Disabled"), N_("Synchronize"), N_("Copy From Pilot"), N_("Copy To Pilot"), N_("Merge From Pilot"), N_("Merge To Pilot")}; #define SYNC_OPTIONS_COUNT 6 static void doTrySettings (GtkWidget *widget, EAddrConduitCfg *c) { if (c->sync_type != GnomePilotConduitSyncTypeCustom) gnome_pilot_conduit_config_enable_with_first_sync (conduit_config, c->sync_type, c->sync_type, TRUE); else gnome_pilot_conduit_config_disable (conduit_config); addrconduit_save_configuration (c); } static void doRevertSettings (GtkWidget *widget, EAddrConduitCfg *c) { activated = org_activation_state; *c = *origState; setStateCfg (cfgStateWindow, c); doTrySettings (widget, c); } static void doSaveSettings (GtkWidget *widget, EAddrConduitCfg *c) { *origState = *c; doTrySettings (widget, c); } static void doHelp (GtkWidget *widget, gpointer data) { GtkWidget *about; const gchar *authors[] = { _("JP Rosevear "), "", _("Original Author:"), _("Eskil Heyn Olsen "), NULL}; about = gnome_about_new ( _("Evolution Addressbook Conduit"), VERSION, _("(C) 1998-2000 the Free Software Foundation and Helix Code"), authors, _("Configuration utility for the evolution addressbook conduit.\n"), _("gnome-unknown.xpm")); gtk_widget_show (about); return; } /* called by the sync_type GtkOptionMenu */ static void activate_sync_type (GtkMenuItem *widget, gpointer data) { curState->sync_type = GPOINTER_TO_INT (data); if (!ignore_changes) capplet_widget_state_changed (CAPPLET_WIDGET (capplet), TRUE); } static GtkWidget * createStateCfgWindow(void) { GtkWidget *vbox, *table; GtkWidget *label; GtkWidget *optionMenu,*menuItem; GtkMenu *menu; gint i; vbox = gtk_vbox_new(FALSE, GNOME_PAD); table = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD); label = gtk_label_new(_("Synchronize Action")); gtk_box_pack_start(GTK_BOX(table), label, FALSE, FALSE, GNOME_PAD); optionMenu=gtk_option_menu_new(); gtk_object_set_data(GTK_OBJECT(vbox), "conduit_state", optionMenu); menu = GTK_MENU(gtk_menu_new()); for (i=0; isync_type); ignore_changes = FALSE; } static void pilot_capplet_setup(void) { GtkWidget *frame, *table; capplet = capplet_widget_new(); table = gtk_table_new(1, 2, FALSE); gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD); gtk_container_add(GTK_CONTAINER(capplet), table); frame = gtk_frame_new(_("Conduit state")); gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL); gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1); cfgStateWindow = createStateCfgWindow(); gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow); gtk_signal_connect(GTK_OBJECT(capplet), "try", GTK_SIGNAL_FUNC(doTrySettings), curState); gtk_signal_connect(GTK_OBJECT(capplet), "revert", GTK_SIGNAL_FUNC(doRevertSettings), curState); gtk_signal_connect(GTK_OBJECT(capplet), "ok", GTK_SIGNAL_FUNC(doSaveSettings), curState); gtk_signal_connect(GTK_OBJECT(capplet), "help", GTK_SIGNAL_FUNC(doHelp), NULL); setStateCfg (cfgStateWindow, curState); gtk_widget_show_all (capplet); } static void run_error_dialog(gchar *mesg,...) { char tmp[80]; va_list ap; va_start(ap,mesg); vsnprintf(tmp,79,mesg,ap); dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL); gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow)); va_end(ap); } static gint get_pilot_id_from_gpilotd() { GList *pilots=NULL; gint pilot; int i,err; i=0; /* we don't worry about leaking here, so pilots isn't freed */ switch(err = gnome_pilot_client_get_pilots(gpc,&pilots)) { case GPILOTD_OK: { if(pilots) { for(i=0;idata); } if(i==0) { run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first.")); return -1; } else { gnome_pilot_client_get_pilot_id_by_name(gpc, pilots->data, /* this is the first pilot */ &pilot); if(i>1) { g_message("too many pilots..."); /* need a choose here */ } return pilot; } } else { run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first.")); return -1; } break; } case GPILOTD_ERR_NOT_CONNECTED: run_error_dialog(_("Not connected to the gnome-pilot daemon")); return -1; break; default: g_warning("gnome_pilot_client_get_pilot_ids(...) = %d",err); run_error_dialog(_("An error occured when trying to fetch\npilot list from the gnome-pilot daemon")); return -1; break; } } int main (int argc, char *argv[]) { g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING); /* Init capplet */ gnome_capplet_init ("Evolution Address conduit control applet", NULL, argc, argv, NULL, 0, NULL); /* Setup Client */ gpc = gnome_pilot_client_new (); gnome_pilot_client_connect_to_daemon (gpc); pilotId = get_pilot_id_from_gpilotd (); if (!pilotId) return -1; /* Put all code to set things up in here */ conduit = gnome_pilot_conduit_management_new ("e_address_conduit", GNOME_PILOT_CONDUIT_MGMT_ID); if (conduit == NULL) return -1; addrconduit_load_configuration (&origState, pilotId); conduit_config = gnome_pilot_conduit_config_new (conduit, pilotId); org_activation_state = activated = gnome_pilot_conduit_config_is_enabled (conduit_config, &origState->sync_type); curState = addrconduit_dupe_configuration (origState); pilot_capplet_setup (); /* Done setting up, now run main loop */ capplet_gtk_main(); /* Clean up */ gnome_pilot_conduit_management_destroy (conduit); addrconduit_destroy_configuration (&origState); addrconduit_destroy_configuration (&curState); return 0; } >Cleanup plistantoine2014-11-124-6/+0 * vietnamese/vnless: this port is not jobs safemarino2014-11-051-0/+2 * Update to 4.3.3.jkim2014-11-011-4/+4 * Deprecate ports broken for more than 6 monthsantoine2014-10-261-0/+2 * KDE/FreeBSD team presents KDE SC 4.14.2 and KDE Workspace 4.11.13!makc2014-10-192-3/+4 * Update to 4.3.2.jkim2014-10-172-5/+4 * Update the default version of GCC in the Ports Collection from GCC 4.7.4gerald2014-09-112-1/+2 * Remove non staged ports without pending PR from textproc and vietnamesebapt2014-09-0223-923/+0 * Mark BROKEN: Fails to installantoine2014-08-311-0/+2 * Upgrade OpenEXR and ilmbase to 2.2.0.mandree2014-08-161-0/+1 * - Fix build with clang (functions not returing value)pawel2014-08-087-20/+20 * Add staging supportpawel2014-08-071-5/+2 * Add staging supportpawel2014-08-071-5/+2 * Add staging supportpawel2014-08-071-5/+2 * Add staging supportpawel2014-08-071-5/+2 * Remove indefinite articles and trailing periods from COMMENT, plusolgeni2014-08-032-2/+2 * Convert some more USE_BZIP2 to USES=tar:bzip2adamw2014-07-301-1/+1 * Rename vietnamese/ patch-xy patches to reflect the files they modify.adamw2014-07-296-0/+0 * vietnamese/libviet: Fix last commitmarino2014-07-291-1/+1 * vietnamese/libviet: respect CC/CFLAGSmarino2014-07-281-0/+2 * vietnamese/vnroff: integrate pkg-plist and cleanup makefilemarino2014-07-282-8/+8 * - Add LICENSEsunpoet2014-07-171-0/+2 * 1: remove NO_STAGE.vanilla2014-07-161-2/+1 * Resetting maintainership on ports that have not been staged and without anybapt2014-07-035-5/+5 * Stagify.vanilla2014-07-024-22/+32 * Update to 4.2.5.jkim2014-06-241-4/+4 * Update to libreoffice 4.2.4bapt2014-06-111-4/+4 * vietnamese/vis2u: Fix EXTRACT_AFTER_ARGSmarino2014-06-011-2/+1 * vietnamese/unicode-uhoai: Fix deinstall and add stage supportmarino2014-05-313-10/+19 * KDE/FreeBSD team presents KDE SC 4.12.5 and KDE Workspace 4.11.9!makc2014-05-111-2/+2 * Update to 4.1.6.jkim2014-05-071-4/+4 * Mark broken: Conflicts with dependency vnpstext on share/vn-fonts/initcour.psantoine2014-04-061-0/+2 * KDE/FreeBSD team presents KDE SC 4.12.4 and KDE Workspace 4.11.8!makc2014-04-031-2/+2 * Support stagingehaupt2014-03-172-10/+12 * Stagify, generally cleanup Makefile, provide more useful port description.danfe2014-03-162-17/+23 * Support stagingehaupt2014-03-132-6/+5 * Unbreakantoine2014-03-121-1/+1 * Unbreakantoine2014-03-121-1/+1 * Convert u* and v* to USES=zipbapt2014-03-117-7/+7 * KDE/FreeBSD team presents KDE SC 4.12.3 and KDE Workspace 4.11.7!makc2014-03-051-2/+2 * Support stagingehaupt2014-02-271-4/+2 * - Stage supportmiwi2014-02-263-7/+6 * Update to 4.1.5. It is partially based on the following PR.jkim2014-02-261-4/+4 * KDE/FreeBSD team presents KDE SC 4.12.2 and KDE Workspace 4.11.6!makc2014-02-183-6/+23 * Fix properties on pkg-plistbapt2014-01-2210-10/+0 * Support stagebapt2014-01-203-7/+5 * - Use single space after WWW:sunpoet2013-11-181-1/+1 * Support stage, use bsdtar to extractbapt2013-11-041-4/+3 * Stagifybapt2013-11-041-1/+0 * - Update to 4.0.6.jkim2013-10-262-5/+4 * Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-2121-110/+39 * Update to 4.0.5.jkim2013-08-231-4/+4 * KDE3 and QT3 expired on 2013-07-01, remove these ports.rene2013-07-275-369/+0 * Fix INDEX by really fixing the kde4-l10n portsbapt2013-07-101-0/+1 * KDE4 l10n fixes.rakuco2013-07-101-2/+1 * Update the KDE Software Compilation to 4.10.5.rakuco2013-07-051-2/+2 * Update to KDE SC 4.10.4, proudly presented by the KDE on FreeBSD team.rakuco2013-07-031-2/+2 * Update to 4.0.4.jkim2013-06-201-4/+4 * - Fix ttfm's xttfm module to really update fonts.{dir,scale} to reflectrafan2013-06-204-4/+4 * Fix build with clangbapt2013-05-271-2/+11 * KDE/FreeBSD team presents KDE SC 4.10.3 ports!makc2013-05-192-4/+2 * Rectify USE_TEX to support both of teTeX and TeXLive.hrs2013-05-121-1/+1 * Update to 4.0.3.jkim2013-05-101-4/+4 * Remove *_DEPENDS from ports which depend on teTeX and add USE_TEX=tetexhrs2013-05-061-3/+1 * - Convert USE_GETTEXT to USES (part 2)ak2013-04-241-1/+1 * Update to 4.0.2.jkim2013-04-171-4/+4 * KDE/FreeBSD team presents KDE SC 4.10.1 ports!makc2013-03-273-5/+12 * 2013-03-05 ftp/proma: Broken for more than 6 monthbapt2013-03-1033-2132/+0 * Update to 4.0.1.jkim2013-03-092-5/+5 * Mark as deprecated a bunch of ports that are marked as broken for more than 6bapt2013-02-052-12/+8 * Update to 3.6.5.jkim2013-02-051-4/+4 * KDE/FreeBSD team presents KDE SC 4.9.5 ports!makc2013-02-043-9/+13 * - Deprecate QT3, KDE3 and unmaintained ports depending on them. QT 3.3.8beat2012-12-301-0/+3 * - Update to 3.5.7.jkim2012-10-272-9/+4 * - Update to 3.5.6.jkim2012-08-241-4/+4 * - Update LibreOffice and the language packs to 3.5.5.jkim2012-07-181-4/+4 * - The FreeBSD Office team is proud to announce LibreOffice.org 3.5.4 releasefluffy2012-07-011-4/+4 * KDE/FreeBSD team presents KDE SC 4.8.4, probably the last release in 4.8.x se...makc2012-06-15