aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@novell.com>2010-04-10 04:09:46 +0800
committerFederico Mena Quintero <federico@novell.com>2010-04-10 04:09:46 +0800
commitb360395495a273356355959c1067c00abf18e2d4 (patch)
tree8316320e8e3c2078fafa9ced6a503197b5e6d6cd
parent5b5ac7a174676bf665b627b25d25ae9a9de689f4 (diff)
parenta16f08974d6955f843dddce3b9423c5349873488 (diff)
downloadgsoc2013-evolution-b360395495a273356355959c1067c00abf18e2d4.tar.gz
gsoc2013-evolution-b360395495a273356355959c1067c00abf18e2d4.tar.zst
gsoc2013-evolution-b360395495a273356355959c1067c00abf18e2d4.zip
Merge branch 'express2' into express2-reduced-preferences
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c2
-rw-r--r--capplet/settings/mail-view.c3
-rw-r--r--configure.ac45
-rw-r--r--e-util/e-datetime-format.c3
-rw-r--r--mail/e-mail-browser.c12
-rw-r--r--mail/e-mail-display.c4
-rw-r--r--mail/e-mail-reader.c4
-rw-r--r--mail/em-format-html.c68
-rw-r--r--mail/message-list.c8
-rw-r--r--modules/Makefile.am7
-rw-r--r--modules/mail/em-composer-prefs.c4
-rw-r--r--modules/windows-sens/Makefile.am20
-rw-r--r--modules/windows-sens/evolution-windows-sens.c602
-rw-r--r--shell/e-shell-utils.c2
-rw-r--r--shell/e-shell-window-private.c2
-rw-r--r--widgets/misc/e-web-view.c2
16 files changed, 722 insertions, 66 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 36bd4ed948..d10ceeac6f 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -605,6 +605,8 @@ e_contact_quick_add_email (const gchar *email, EContactQuickAddCallback cb, gpoi
if (lt != NULL && gt != NULL && (gt - lt) > 0) {
name = g_strndup (email, lt - email);
addr = g_strndup (lt + 1, gt - lt - 1);
+ } else {
+ addr = email;
}
e_contact_quick_add (name, addr, cb, closure);
diff --git a/capplet/settings/mail-view.c b/capplet/settings/mail-view.c
index 84214888a9..a344d59251 100644
--- a/capplet/settings/mail-view.c
+++ b/capplet/settings/mail-view.c
@@ -319,7 +319,6 @@ mail_view_add_folder (MailView *mv, gpointer data, gboolean block)
g_signal_connect (mfv, "view-close", G_CALLBACK(mv_close_mcv), mv);
if (!block)
gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
- gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)mfv, FALSE, FALSE, 0);
g_signal_connect (mfv, "message-shown", G_CALLBACK(mv_message_shown), mv);
g_signal_connect (mfv, "message-new", G_CALLBACK(mv_message_new), mv);
g_signal_connect (mfv, "search-set", G_CALLBACK(mv_search_set), mv);
@@ -359,7 +358,6 @@ mail_view_add_composer (MailView *mv, gpointer data, gboolean block)
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, FALSE);
if (!block)
gtk_notebook_set_current_page ((GtkNotebook *)mv, position);
- gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)mcv, FALSE, FALSE, 0);
if (!block)
mail_composer_view_activate (mcv, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
@@ -387,7 +385,6 @@ mail_view_add_message (MailView *mv, gpointer data, gboolean block)
gtk_notebook_set_tab_detachable (GTK_NOTEBOOK (mv), (GtkWidget *)mcv, FALSE);
if (!block)
gtk_notebook_set_current_page ((GtkNotebook *)mv, position+1);
- gtk_notebook_set_tab_label_packing ((GtkNotebook *)mv, (GtkWidget *)mcv, FALSE, FALSE, 0);
if (!block)
mail_conv_view_activate (mcv, mv->tree, mv->folder_tree, mv->check_mail, mv->sort_by, FALSE);
diff --git a/configure.ac b/configure.ac
index 7701a76003..2ee9683026 100644
--- a/configure.ac
+++ b/configure.ac
@@ -657,8 +657,8 @@ if test "x$enable_pilot_conduits" = "xyes"; then
CFLAGS_save="$CFLAGS"
CFLAGS="$CFLAGS $GNOME_PILOT_CFLAGS"
- LDFLAGS_save="$LDFLAGS"
- LDFLAGS="$GNOME_PILOT_LIBS $LDFLAGS"
+ LIBS_save="$LIBS"
+ LIBS="$LIBS $GNOME_PILOT_LIBS $LDFLAGS"
AC_CACHE_CHECK([if pilot-link handles UTF-8 conversions],[ac_cv_pilot_link_utf8],
AC_RUN_IFELSE([AC_LANG_SOURCE(
@@ -678,7 +678,7 @@ if test "x$enable_pilot_conduits" = "xyes"; then
)],[ac_cv_pilot_link_utf8=yes],[ac_cv_pilot_link_utf8=no],[ac_cv_pilot_link_utf8=no]))
CFLAGS="$CFLAGS_save"
- LDFLAGS="$LDFLAGS_save"
+ LIBS="$LIBS_save"
if test "$ac_cv_pilot_link_utf8" = no; then
AC_MSG_ERROR([evolution requires pilot-link to have working UTF-8 conversion routines])
@@ -1140,9 +1140,45 @@ if test "$enable_nm" = yes; then
AC_SUBST(HAVE_NM)
AC_SUBST(NM_CFLAGS)
fi
+
AM_CONDITIONAL([ENABLE_NETWORK_MANAGER], [test "$enable_nm" = yes])
dnl ******************************
+dnl Check for Windows SENS API
+dnl ******************************
+AC_ARG_ENABLE([sens],
+ [AS_HELP_STRING([--enable-sens],
+ [enable Windows SENS support (default=yes)])],
+ [enable_sens=$enableval],[enable_sens=yes])
+if test "x$os_win32" = xyes; then
+ if test "x$enable_sens" = xyes; then
+ AC_CHECK_HEADER([rpc.h],[ enable_sens="yes" ],[ enable_sens="no" ])
+ fi
+else
+ enable_sens="no"
+fi
+AC_MSG_CHECKING([if Windows SENS support is enabled])
+AC_MSG_RESULT([$enable_sens])
+if test "$enable_sens" = yes; then
+ SENS_LIBS="-lole32 -loleaut32 -luuid -lrpcrt4"
+ AC_CHECK_HEADER([eventsys.h],
+ [AC_DEFINE([HAVE_EVENTSYS_H], 1, [Have <eventsys.h>])],,
+ [[ #if HAVE_EVENTSYS_H
+ #include <eventsys.h>
+ #endif
+ ]])
+ AC_CHECK_HEADER([sensevts.h],
+ [AC_DEFINE([HAVE_SENSEVTS_H], 1, [Have <sensevts.h>])],,
+ [[ #if HAVE_SENSEVTS_H
+ #include <sensevts.h>
+ #endif
+ ]])
+ AC_SUBST(HAVE_SENS)
+ AC_SUBST(SENS_LIBS)
+fi
+AM_CONDITIONAL([ENABLE_WINDOWS_SENS], [test "$enable_sens" = yes])
+
+dnl ******************************
dnl Enable ConnMan support ?
dnl ******************************
AC_ARG_ENABLE([connman],
@@ -1706,6 +1742,7 @@ modules/connman/Makefile
modules/plugin-lib/Makefile
modules/plugin-mono/Makefile
modules/plugin-python/Makefile
+modules/windows-sens/Makefile
plugins/Makefile
plugins/addressbook-file/Makefile
plugins/attachment-reminder/Makefile
@@ -1774,6 +1811,8 @@ fi
echo "
LDAP support: $msg_ldap
NetworkManager: $enable_nm
+ Windows SENS: $enable_sens
+ ConnMan: $enable_connman
Pilot conduits: $msg_pilot
Libnotify: $HAVE_LIBNOTIFY
Kerberos 5: $msg_krb5
diff --git a/e-util/e-datetime-format.c b/e-util/e-datetime-format.c
index ec3e4fb8fe..0595d58add 100644
--- a/e-util/e-datetime-format.c
+++ b/e-util/e-datetime-format.c
@@ -29,6 +29,9 @@
#define KEYS_GROUPNAME "formats"
#ifdef G_OS_WIN32
+#ifdef localtime_r
+#undef localtime_r
+#endif
/* The localtime() in Microsoft's C library *is* thread-safe */
#define localtime_r(timep, result) (localtime (timep) ? memcpy ((result), localtime (timep), sizeof (*(result))) : 0)
#endif
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c
index a6461e2bfe..78dd91b5c2 100644
--- a/mail/e-mail-browser.c
+++ b/mail/e-mail-browser.c
@@ -244,6 +244,7 @@ mail_browser_message_selected_cb (EMailBrowser *browser,
CamelMessageInfo *info;
CamelFolder *folder;
EMailReader *reader;
+ const gchar *title;
if (uid == NULL)
return;
@@ -257,9 +258,14 @@ mail_browser_message_selected_cb (EMailBrowser *browser,
if (info == NULL)
return;
- gtk_window_set_title (
- GTK_WINDOW (browser),
- camel_message_info_subject (info));
+ /* XXX The string here was added after the 2.30.0 release, so
+ * it's not marked for translation. But it IS marked for
+ * translation in 2.31. */
+ title = camel_message_info_subject (info);
+ if (title == NULL || *title == '\0')
+ title = "(No Subject)";
+
+ gtk_window_set_title (GTK_WINDOW (browser), title);
gtk_widget_grab_focus (
GTK_WIDGET (((EMFormatHTML *) html_display)->html));
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 9f9569dd8a..fda1f3a034 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -255,12 +255,12 @@ mail_display_link_clicked (GtkHTML *html,
if (!(flags & EM_FORMAT_HTML_HEADER_CC))
flags |= EM_FORMAT_HTML_HEADER_CC;
else
- flags |= EM_FORMAT_HTML_HEADER_CC;
+ flags &= ~EM_FORMAT_HTML_HEADER_CC;
} else if (strcmp (uri, "##BCC##") == 0) {
if (!(flags & EM_FORMAT_HTML_HEADER_BCC))
flags |= EM_FORMAT_HTML_HEADER_BCC;
else
- flags |= EM_FORMAT_HTML_HEADER_BCC;
+ flags &= ~EM_FORMAT_HTML_HEADER_BCC;
}
priv->formatter->header_wrap_flags = flags;
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 97919c5888..684b97c085 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -2145,8 +2145,12 @@ mail_reader_update_actions (EMailReader *reader)
shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
+#ifndef G_OS_WIN32
disable_printing = e_shell_settings_get_boolean (
shell_settings, "disable-printing");
+#else
+ disable_printing = FALSE;
+#endif
have_an_account =
(state & E_MAIL_READER_HAVE_ACCOUNT);
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 8e1cfcef3e..62e190f4b2 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -1492,17 +1492,22 @@ efh_url_requested(GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMForm
} else if (g_ascii_strncasecmp(url, "http:", 5) == 0 || g_ascii_strncasecmp(url, "https:", 6) == 0) {
d(printf(" adding job, get %s\n", url));
job = em_format_html_job_new(efh, emfh_gethttp, g_strdup(url));
- } else if (g_ascii_strncasecmp(url, "/", 1) == 0) {
+ } else if (g_str_has_prefix (url, "file://")) {
gchar *data = NULL;
gsize length = 0;
gboolean status;
+ gchar *path;
+
+ path = g_filename_from_uri (url, NULL, NULL);
+ g_return_if_fail (path != NULL);
- status = g_file_get_contents (url, &data, &length, NULL);
+ status = g_file_get_contents (path, &data, &length, NULL);
if (status)
gtk_html_stream_write (handle, data, length);
- gtk_html_stream_close(handle, status? GTK_HTML_STREAM_OK : GTK_HTML_STREAM_ERROR);
+ gtk_html_stream_close (handle, status ? GTK_HTML_STREAM_OK : GTK_HTML_STREAM_ERROR);
g_free (data);
+ g_free (path);
} else {
d(printf("HTML Includes reference to unknown uri '%s'\n", url));
gtk_html_stream_close(handle, GTK_HTML_STREAM_ERROR);
@@ -2307,74 +2312,43 @@ efh_format_address (EMFormatHTML *efh, GString *out, struct _camel_header_addres
/* Let us add a '...' if we have more addresses */
if (limit > 0 && wrap && a && (i>(limit-1))) {
-
- gchar * evolution_imagesdir = g_filename_to_uri(EVOLUTION_IMAGESDIR, NULL, NULL);
+ gchar *evolution_imagesdir = g_filename_to_uri (EVOLUTION_IMAGESDIR, NULL, NULL);
if (!strcmp (field, _("To"))) {
-
g_string_append (out, "<a href=\"##TO##\">...</a>");
-#ifdef G_OS_WIN32
- str = g_strdup_printf ("<a href=\"##TO##\">+</a> ");
-#else
- str = g_strdup_printf ("<a href=\"##TO##\"><img src=\"%s/plus.png\" /></a> ", evolution_imagesdir);
-#endif
- g_free(evolution_imagesdir);
-
- return str;
+ str = g_strdup_printf ("<a href=\"##TO##\"><img src=\"%s/plus.png\"></a> ", evolution_imagesdir);
}
else if (!strcmp (field, _("Cc"))) {
g_string_append (out, "<a href=\"##CC##\">...</a>");
-#ifdef G_OS_WIN32
- str = g_strdup_printf ("<a href=\"##CC##\">+</a> ");
-#else
- str = g_strdup_printf ("<a href=\"##CC##\"><img src=\"%s/plus.png\" /></a> ", evolution_imagesdir);
-#endif
- g_free(evolution_imagesdir);
-
- return str;
+ str = g_strdup_printf ("<a href=\"##CC##\"><img src=\"%s/plus.png\"></a> ", evolution_imagesdir);
}
else if (!strcmp (field, _("Bcc"))) {
g_string_append (out, "<a href=\"##BCC##\">...</a>");
-#ifdef G_OS_WIN32
- str = g_strdup_printf ("<a href=\"##BCC##\">+</a> ");
-#else
- str = g_strdup_printf ("<a href=\"##BCC##\"><img src=\"%s/plus.png\" /></a> ", evolution_imagesdir);
-#endif
- g_free(evolution_imagesdir);
+ str = g_strdup_printf ("<a href=\"##BCC##\"><img src=\"%s/plus.png\"></a> ", evolution_imagesdir);
+ }
+ g_free (evolution_imagesdir);
+
+ if (str)
return str;
- }
}
}
if (limit > 0 && i>(limit)) {
-
- gchar * evolution_imagesdir = g_filename_to_uri(EVOLUTION_IMAGESDIR, NULL, NULL);
+ gchar *evolution_imagesdir = g_filename_to_uri (EVOLUTION_IMAGESDIR, NULL, NULL);
if (!strcmp (field, _("To"))) {
-#ifdef G_OS_WIN32
- str = g_strdup_printf ("<a href=\"##TO##\">-</a> ");
-#else
- str = g_strdup_printf ("<a href=\"##TO##\"><img src=\"%s/minus.png\" /></a> ", evolution_imagesdir);
-#endif
+ str = g_strdup_printf ("<a href=\"##TO##\"><img src=\"%s/minus.png\"></a> ", evolution_imagesdir);
}
else if (!strcmp (field, _("Cc"))) {
-#ifdef G_OS_WIN32
- str = g_strdup_printf ("<a href=\"##CC##\">-</a> ");
-#else
- str = g_strdup_printf ("<a href=\"##CC##\"><img src=\"%s/minus.png\" /></a> ", evolution_imagesdir);
-#endif
+ str = g_strdup_printf ("<a href=\"##CC##\"><img src=\"%s/minus.png\"></a> ", evolution_imagesdir);
}
else if (!strcmp (field, _("Bcc"))) {
-#ifdef G_OS_WIN32
- str = g_strdup_printf ("<a href=\"##BCC##\">-</a> ");
-#else
- str = g_strdup_printf ("<a href=\"##BCC##\"><img src=\"%s/minus.png\" /></a> ", evolution_imagesdir);
-#endif
+ str = g_strdup_printf ("<a href=\"##BCC##\"><img src=\"%s/minus.png\"></a> ", evolution_imagesdir);
}
- g_free(evolution_imagesdir);
+ g_free (evolution_imagesdir);
}
return str;
diff --git a/mail/message-list.c b/mail/message-list.c
index 02b7ce9908..ed1236524c 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2517,12 +2517,6 @@ message_list_finalize (GObject *object)
}
static void
-message_list_built (MessageList *message_list)
-{
- gtk_widget_grab_focus (GTK_WIDGET (message_list));
-}
-
-static void
message_list_selectable_update_actions (ESelectable *selectable,
EFocusTracker *focus_tracker,
GdkAtom *clipboard_targets,
@@ -2563,7 +2557,7 @@ message_list_class_init (MessageListClass *class)
gtk_object_class = GTK_OBJECT_CLASS (class);
gtk_object_class->destroy = message_list_destroy;
- class->message_list_built = message_list_built;
+ class->message_list_built = NULL;
/* Inherited from ESelectableInterface */
g_object_class_override_property (
diff --git a/modules/Makefile.am b/modules/Makefile.am
index c38f26b24a..4c0c38dcbb 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -14,6 +14,10 @@ if ENABLE_CONNMAN
CONNMAN_DIR = connman
endif
+if ENABLE_WINDOWS_SENS
+WINDOWS_SENS_DIR = windows-sens
+endif
+
SUBDIRS = \
addressbook \
calendar \
@@ -21,7 +25,8 @@ SUBDIRS = \
plugin-lib \
$(MONO_DIR) \
$(PYTHON_DIR) \
- $(NETWORK_MANAGER_DIR)
+ $(NETWORK_MANAGER_DIR) \
+ $(WINDOWS_SENS_DIR) \
$(CONNMAN_DIR)
-include $(top_srcdir)/git.mk
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 05c4bd30c2..72c5d18b25 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -529,9 +529,11 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
shell_settings, "composer-format-html",
widget, "prefer-html");
+#ifndef G_OS_WIN32
e_binding_new_with_negation (
shell_settings, "disable-command-line",
widget, "allow-scripts");
+#endif
signature_tree_view = e_signature_manager_get_tree_view (
E_SIGNATURE_MANAGER (widget));
@@ -541,9 +543,11 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
gtk_container_add (GTK_CONTAINER (container), widget);
gtk_widget_show (widget);
+#ifndef G_OS_WIN32
e_binding_new_with_negation (
shell_settings, "disable-command-line",
widget, "allow-scripts");
+#endif
e_binding_new (
signature_tree_view, "selected",
diff --git a/modules/windows-sens/Makefile.am b/modules/windows-sens/Makefile.am
new file mode 100644
index 0000000000..5036642d09
--- /dev/null
+++ b/modules/windows-sens/Makefile.am
@@ -0,0 +1,20 @@
+module_LTLIBRARIES = libevolution-module-windows-sens.la
+
+libevolution_module_windows_sens_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ -DG_LOG_DOMAIN=\"evolution-windows-sens\" \
+ $(GNOME_PLATFORM_CFLAGS)
+
+libevolution_module_windows_sens_la_SOURCES = \
+ evolution-windows-sens.c
+
+libevolution_module_windows_sens_la_LIBADD = \
+ $(top_builddir)/shell/libeshell.la \
+ $(GNOME_PLATFORM_LIBS) \
+ $(SENS_LIBS)
+
+libevolution_module_windows_sens_la_LDFLAGS = \
+ -module -avoid-version $(NO_UNDEFINED)
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/windows-sens/evolution-windows-sens.c b/modules/windows-sens/evolution-windows-sens.c
new file mode 100644
index 0000000000..d228fc02ac
--- /dev/null
+++ b/modules/windows-sens/evolution-windows-sens.c
@@ -0,0 +1,602 @@
+/*
+ * evolution-windows-sens.c
+ *
+ * This program 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 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifdef __cplusplus
+#error This file cannot be built with C++ compiler
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define INITGUID
+#include <windows.h>
+#include <rpc.h>
+
+#ifdef HAVE_EVENTSYS_H
+#include <eventsys.h>
+#else
+
+/* Extract relevant typedefs from mingw-w64 headers */
+
+typedef struct IEnumEventObject IEnumEventObject;
+
+const IID IID_IEnumEventObject;
+typedef struct IEnumEventObjectVtbl {
+ BEGIN_INTERFACE
+ HRESULT (WINAPI *QueryInterface)(IEnumEventObject *This,REFIID riid,void **ppvObject);
+ ULONG (WINAPI *AddRef)(IEnumEventObject *This);
+ ULONG (WINAPI *Release)(IEnumEventObject *This);
+ HRESULT (WINAPI *Clone)(IEnumEventObject *This,IEnumEventObject **ppInterface);
+ HRESULT (WINAPI *Next)(IEnumEventObject *This,ULONG cReqElem,IUnknown **ppInterface,ULONG *cRetElem);
+ HRESULT (WINAPI *Reset)(IEnumEventObject *This);
+ HRESULT (WINAPI *Skip)(IEnumEventObject *This,ULONG cSkipElem);
+ END_INTERFACE
+} IEnumEventObjectVtbl;
+struct IEnumEventObject {
+ CONST_VTBL struct IEnumEventObjectVtbl *lpVtbl;
+};
+
+typedef struct IEventObjectCollection IEventObjectCollection;
+
+const IID IID_IEventObjectCollection;
+typedef struct IEventObjectCollectionVtbl {
+ BEGIN_INTERFACE
+ HRESULT (WINAPI *QueryInterface)(IEventObjectCollection *This,REFIID riid,void **ppvObject);
+ ULONG (WINAPI *AddRef)(IEventObjectCollection *This);
+ ULONG (WINAPI *Release)(IEventObjectCollection *This);
+ HRESULT (WINAPI *GetTypeInfoCount)(IEventObjectCollection *This,UINT *pctinfo);
+ HRESULT (WINAPI *GetTypeInfo)(IEventObjectCollection *This,UINT iTInfo,LCID lcid,ITypeInfo **ppTInfo);
+ HRESULT (WINAPI *GetIDsOfNames)(IEventObjectCollection *This,REFIID riid,LPOLESTR *rgszNames,UINT cNames,LCID lcid,DISPID *rgDispId);
+ HRESULT (WINAPI *Invoke)(IEventObjectCollection *This,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr);
+ HRESULT (WINAPI *get__NewEnum)(IEventObjectCollection *This,IUnknown **ppUnkEnum);
+ HRESULT (WINAPI *get_Item)(IEventObjectCollection *This,BSTR objectID,VARIANT *pItem);
+ HRESULT (WINAPI *get_NewEnum)(IEventObjectCollection *This,IEnumEventObject **ppEnum);
+ HRESULT (WINAPI *get_Count)(IEventObjectCollection *This,long *pCount);
+ HRESULT (WINAPI *Add)(IEventObjectCollection *This,VARIANT *item,BSTR objectID);
+ HRESULT (WINAPI *Remove)(IEventObjectCollection *This,BSTR objectID);
+ END_INTERFACE
+} IEventObjectCollectionVtbl;
+struct IEventObjectCollection {
+ CONST_VTBL struct IEventObjectCollectionVtbl *lpVtbl;
+};
+
+
+typedef struct IEventSystem IEventSystem;
+
+const IID IID_IEventSystem;
+typedef struct IEventSystemVtbl {
+ BEGIN_INTERFACE
+ HRESULT (WINAPI *QueryInterface)(IEventSystem *This,REFIID riid,void **ppvObject);
+ ULONG (WINAPI *AddRef)(IEventSystem *This);
+ ULONG (WINAPI *Release)(IEventSystem *This);
+ HRESULT (WINAPI *GetTypeInfoCount)(IEventSystem *This,UINT *pctinfo);
+ HRESULT (WINAPI *GetTypeInfo)(IEventSystem *This,UINT iTInfo,LCID lcid,ITypeInfo **ppTInfo);
+ HRESULT (WINAPI *GetIDsOfNames)(IEventSystem *This,REFIID riid,LPOLESTR *rgszNames,UINT cNames,LCID lcid,DISPID *rgDispId);
+ HRESULT (WINAPI *Invoke)(IEventSystem *This,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr);
+ HRESULT (WINAPI *Query)(IEventSystem *This,BSTR progID,BSTR queryCriteria,int *errorIndex,IUnknown **ppInterface);
+ HRESULT (WINAPI *Store)(IEventSystem *This,BSTR ProgID,IUnknown *pInterface);
+ HRESULT (WINAPI *Remove)(IEventSystem *This,BSTR progID,BSTR queryCriteria,int *errorIndex);
+ HRESULT (WINAPI *get_EventObjectChangeEventClassID)(IEventSystem *This,BSTR *pbstrEventClassID);
+ HRESULT (WINAPI *QueryS)(IEventSystem *This,BSTR progID,BSTR queryCriteria,IUnknown **ppInterface);
+ HRESULT (WINAPI *RemoveS)(IEventSystem *This,BSTR progID,BSTR queryCriteria);
+ END_INTERFACE
+} IEventSystemVtbl;
+struct IEventSystem {
+ CONST_VTBL struct IEventSystemVtbl *lpVtbl;
+};
+
+typedef struct IEventSubscription IEventSubscription;
+
+const IID IID_IEventSubscription;
+typedef struct IEventSubscriptionVtbl {
+ BEGIN_INTERFACE
+ HRESULT (WINAPI *QueryInterface)(IEventSubscription *This,REFIID riid,void **ppvObject);
+ ULONG (WINAPI *AddRef)(IEventSubscription *This);
+ ULONG (WINAPI *Release)(IEventSubscription *This);
+ HRESULT (WINAPI *GetTypeInfoCount)(IEventSubscription *This,UINT *pctinfo);
+ HRESULT (WINAPI *GetTypeInfo)(IEventSubscription *This,UINT iTInfo,LCID lcid,ITypeInfo **ppTInfo);
+ HRESULT (WINAPI *GetIDsOfNames)(IEventSubscription *This,REFIID riid,LPOLESTR *rgszNames,UINT cNames,LCID lcid,DISPID *rgDispId);
+ HRESULT (WINAPI *Invoke)(IEventSubscription *This,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr);
+ HRESULT (WINAPI *get_SubscriptionID)(IEventSubscription *This,BSTR *pbstrSubscriptionID);
+ HRESULT (WINAPI *put_SubscriptionID)(IEventSubscription *This,BSTR bstrSubscriptionID);
+ HRESULT (WINAPI *get_SubscriptionName)(IEventSubscription *This,BSTR *pbstrSubscriptionName);
+ HRESULT (WINAPI *put_SubscriptionName)(IEventSubscription *This,BSTR bstrSubscriptionName);
+ HRESULT (WINAPI *get_PublisherID)(IEventSubscription *This,BSTR *pbstrPublisherID);
+ HRESULT (WINAPI *put_PublisherID)(IEventSubscription *This,BSTR bstrPublisherID);
+ HRESULT (WINAPI *get_EventClassID)(IEventSubscription *This,BSTR *pbstrEventClassID);
+ HRESULT (WINAPI *put_EventClassID)(IEventSubscription *This,BSTR bstrEventClassID);
+ HRESULT (WINAPI *get_MethodName)(IEventSubscription *This,BSTR *pbstrMethodName);
+ HRESULT (WINAPI *put_MethodName)(IEventSubscription *This,BSTR bstrMethodName);
+ HRESULT (WINAPI *get_SubscriberCLSID)(IEventSubscription *This,BSTR *pbstrSubscriberCLSID);
+ HRESULT (WINAPI *put_SubscriberCLSID)(IEventSubscription *This,BSTR bstrSubscriberCLSID);
+ HRESULT (WINAPI *get_SubscriberInterface)(IEventSubscription *This,IUnknown **ppSubscriberInterface);
+ HRESULT (WINAPI *put_SubscriberInterface)(IEventSubscription *This,IUnknown *pSubscriberInterface);
+ HRESULT (WINAPI *get_PerUser)(IEventSubscription *This,WINBOOL *pfPerUser);
+ HRESULT (WINAPI *put_PerUser)(IEventSubscription *This,WINBOOL fPerUser);
+ HRESULT (WINAPI *get_OwnerSID)(IEventSubscription *This,BSTR *pbstrOwnerSID);
+ HRESULT (WINAPI *put_OwnerSID)(IEventSubscription *This,BSTR bstrOwnerSID);
+ HRESULT (WINAPI *get_Enabled)(IEventSubscription *This,WINBOOL *pfEnabled);
+ HRESULT (WINAPI *put_Enabled)(IEventSubscription *This,WINBOOL fEnabled);
+ HRESULT (WINAPI *get_Description)(IEventSubscription *This,BSTR *pbstrDescription);
+ HRESULT (WINAPI *put_Description)(IEventSubscription *This,BSTR bstrDescription);
+ HRESULT (WINAPI *get_MachineName)(IEventSubscription *This,BSTR *pbstrMachineName);
+ HRESULT (WINAPI *put_MachineName)(IEventSubscription *This,BSTR bstrMachineName);
+ HRESULT (WINAPI *GetPublisherProperty)(IEventSubscription *This,BSTR bstrPropertyName,VARIANT *propertyValue);
+ HRESULT (WINAPI *PutPublisherProperty)(IEventSubscription *This,BSTR bstrPropertyName,VARIANT *propertyValue);
+ HRESULT (WINAPI *RemovePublisherProperty)(IEventSubscription *This,BSTR bstrPropertyName);
+ HRESULT (WINAPI *GetPublisherPropertyCollection)(IEventSubscription *This,IEventObjectCollection **collection);
+ HRESULT (WINAPI *GetSubscriberProperty)(IEventSubscription *This,BSTR bstrPropertyName,VARIANT *propertyValue);
+ HRESULT (WINAPI *PutSubscriberProperty)(IEventSubscription *This,BSTR bstrPropertyName,VARIANT *propertyValue);
+ HRESULT (WINAPI *RemoveSubscriberProperty)(IEventSubscription *This,BSTR bstrPropertyName);
+ HRESULT (WINAPI *GetSubscriberPropertyCollection)(IEventSubscription *This,IEventObjectCollection **collection);
+ HRESULT (WINAPI *get_InterfaceID)(IEventSubscription *This,BSTR *pbstrInterfaceID);
+ HRESULT (WINAPI *put_InterfaceID)(IEventSubscription *This,BSTR bstrInterfaceID);
+ END_INTERFACE
+} IEventSubscriptionVtbl;
+struct IEventSubscription {
+ CONST_VTBL struct IEventSubscriptionVtbl *lpVtbl;
+};
+
+#define PROGID_EventSubscription OLESTR("EventSystem.EventSubscription")
+
+#endif
+
+#ifdef HAVE_SENSEVTS_H
+#include <sensevts.h>
+#else
+
+/* Extract relevant typedefs from mingw-w64 headers */
+
+typedef struct {
+ DWORD dwSize;
+ DWORD dwFlags;
+ DWORD dwOutSpeed;
+ DWORD dwInSpeed;
+} *LPSENS_QOCINFO;
+
+typedef struct ISensNetwork ISensNetwork;
+
+const IID IID_ISensNetwork;
+typedef struct ISensNetworkVtbl {
+ BEGIN_INTERFACE
+ HRESULT (WINAPI *QueryInterface)(ISensNetwork *This,REFIID riid,void **ppvObject);
+ ULONG (WINAPI *AddRef)(ISensNetwork *This);
+ ULONG (WINAPI *Release)(ISensNetwork *This);
+ HRESULT (WINAPI *GetTypeInfoCount)(ISensNetwork *This,UINT *pctinfo);
+ HRESULT (WINAPI *GetTypeInfo)(ISensNetwork *This,UINT iTInfo,LCID lcid,ITypeInfo **ppTInfo);
+ HRESULT (WINAPI *GetIDsOfNames)(ISensNetwork *This,REFIID riid,LPOLESTR *rgszNames,UINT cNames,LCID lcid,DISPID *rgDispId);
+ HRESULT (WINAPI *Invoke)(ISensNetwork *This,DISPID dispIdMember,REFIID riid,LCID lcid,WORD wFlags,DISPPARAMS *pDispParams,VARIANT *pVarResult,EXCEPINFO *pExcepInfo,UINT *puArgErr);
+ HRESULT (WINAPI *ConnectionMade)(ISensNetwork *This,BSTR bstrConnection,ULONG ulType,LPSENS_QOCINFO lpQOCInfo);
+ HRESULT (WINAPI *ConnectionMadeNoQOCInfo)(ISensNetwork *This,BSTR bstrConnection,ULONG ulType);
+ HRESULT (WINAPI *ConnectionLost)(ISensNetwork *This,BSTR bstrConnection,ULONG ulType);
+ HRESULT (WINAPI *DestinationReachable)(ISensNetwork *This,BSTR bstrDestination,BSTR bstrConnection,ULONG ulType,LPSENS_QOCINFO lpQOCInfo);
+ HRESULT (WINAPI *DestinationReachableNoQOCInfo)(ISensNetwork *This,BSTR bstrDestination,BSTR bstrConnection,ULONG ulType);
+ END_INTERFACE
+} ISensNetworkVtbl;
+struct ISensNetwork {
+ CONST_VTBL struct ISensNetworkVtbl *lpVtbl;
+};
+
+#endif
+
+#include <shell/e-shell.h>
+#include <e-util/e-extension.h>
+
+/* 4E14FB9F-2E22-11D1-9964-00C04FBBB345 */
+DEFINE_GUID(IID_IEventSystem, 0x4E14FB9F, 0x2E22, 0x11D1, 0x99, 0x64, 0x00, 0xC0, 0x4F, 0xBB, 0xB3, 0x45);
+
+/* 4A6B0E15-2E38-11D1-9965-00C04FBBB345 */
+DEFINE_GUID(IID_IEventSubscription, 0x4A6B0E15, 0x2E38, 0x11D1, 0x99, 0x65, 0x00, 0xC0, 0x4F, 0xBB, 0xB3, 0x45);
+
+/* d597bab1-5b9f-11d1-8dd2-00aa004abd5e */
+DEFINE_GUID(IID_ISensNetwork, 0xd597bab1, 0x5b9f, 0x11d1, 0x8d, 0xd2, 0x00, 0xaa, 0x00, 0x4a, 0xbd, 0x5e);
+
+/* 4E14FBA2-2E22-11D1-9964-00C04FBBB345 */
+DEFINE_GUID(CLSID_CEventSystem, 0x4E14FBA2, 0x2E22, 0x11D1, 0x99, 0x64, 0x00, 0xC0, 0x4F, 0xBB, 0xB3, 0x45);
+
+/* 7542e960-79c7-11d1-88f9-0080c7d771bf */
+DEFINE_GUID(CLSID_CEventSubscription, 0x7542e960, 0x79c7, 0x11d1, 0x88, 0xf9, 0x00, 0x80, 0xc7, 0xd7, 0x71, 0xbf);
+
+
+/* Standard GObject macros */
+#define E_TYPE_WINDOWS_SENS \
+ (e_windows_sens_get_type ())
+#define E_WINDOWS_SENS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_WINDOWS_SENS, EWindowsSENS))
+
+typedef struct _EWindowsSENS EWindowsSENS;
+typedef struct _EWindowsSENSClass EWindowsSENSClass;
+
+struct _EWindowsSENS {
+ EExtension parent;
+};
+
+struct _EWindowsSENSClass {
+ EExtensionClass parent_class;
+};
+
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType e_windows_sens_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (EWindowsSENS, e_windows_sens, E_TYPE_EXTENSION)
+
+static EShell *
+windows_sens_get_shell (EWindowsSENS *extension)
+{
+ EExtensible *extensible;
+
+ extensible = e_extension_get_extensible (E_EXTENSION (extension));
+
+ return E_SHELL (extensible);
+}
+
+/* Object to receive the ISensNetwork events */
+
+typedef struct ESensNetworkListener {
+ ISensNetworkVtbl *lpVtbl;
+ long ref;
+ EWindowsSENS *ews_ptr;
+} ESensNetworkListener;
+
+static void e_sens_network_listener_init(ESensNetworkListener**,EWindowsSENS*);
+
+/* Functions to implement ISensNetwork interface */
+
+static HRESULT WINAPI e_sens_network_listener_queryinterface (ISensNetwork*,REFIID,void**);
+static ULONG WINAPI e_sens_network_listener_addref (ISensNetwork*);
+static ULONG WINAPI e_sens_network_listener_release (ISensNetwork*);
+static HRESULT WINAPI e_sens_network_listener_gettypeinfocount (ISensNetwork*, UINT*);
+static HRESULT WINAPI e_sens_network_listener_gettypeinfo (ISensNetwork*,UINT,LCID,ITypeInfo**);
+static HRESULT WINAPI e_sens_network_listener_getidsofnames (ISensNetwork*,REFIID,LPOLESTR*,UINT,LCID, DISPID*);
+static HRESULT WINAPI e_sens_network_listener_invoke (ISensNetwork*,DISPID,REFIID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,UINT*);
+static HRESULT WINAPI e_sens_network_listener_connectionmade (ISensNetwork*,BSTR,ULONG,LPSENS_QOCINFO);
+static HRESULT WINAPI e_sens_network_listener_connectionmadenoqocinfo (ISensNetwork*,BSTR,ULONG);
+static HRESULT WINAPI e_sens_network_listener_connectionlost (ISensNetwork*,BSTR,ULONG);
+static HRESULT WINAPI e_sens_network_listener_destinationreachable (ISensNetwork*,BSTR,BSTR,ULONG,LPSENS_QOCINFO);
+static HRESULT WINAPI e_sens_network_listener_destinationreachablenoqocinfo (ISensNetwork*,BSTR,BSTR,ULONG);
+
+/* Initializing the VTable of our ESensNetworkListener object */
+
+static ISensNetworkVtbl ESensNetworkListenerVtbl = {
+ e_sens_network_listener_queryinterface,
+ e_sens_network_listener_addref,
+ e_sens_network_listener_release,
+ e_sens_network_listener_gettypeinfocount,
+ e_sens_network_listener_gettypeinfo,
+ e_sens_network_listener_getidsofnames,
+ e_sens_network_listener_invoke,
+ e_sens_network_listener_connectionmade,
+ e_sens_network_listener_connectionmadenoqocinfo,
+ e_sens_network_listener_connectionlost,
+ e_sens_network_listener_destinationreachable,
+ e_sens_network_listener_destinationreachablenoqocinfo
+};
+
+
+static HRESULT WINAPI
+e_sens_network_listener_queryinterface (ISensNetwork *This,
+ REFIID iid,
+ void **ppv)
+{
+ if (IsEqualIID (iid, &IID_IUnknown) || IsEqualIID (iid, &IID_IDispatch) || IsEqualIID (iid, &IID_ISensNetwork)) {
+ *ppv = This;
+ ((LPUNKNOWN)*ppv)->lpVtbl->AddRef((LPUNKNOWN)*ppv);
+ return S_OK;
+ }
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI
+e_sens_network_listener_addref (ISensNetwork *This)
+{
+ ESensNetworkListener *esnl_ptr=(ESensNetworkListener*)This;
+ return InterlockedIncrement(&(esnl_ptr->ref));
+}
+
+static ULONG WINAPI
+e_sens_network_listener_release (ISensNetwork *This)
+{
+ ESensNetworkListener *esnl_ptr=(ESensNetworkListener*)This;
+ ULONG tmp = InterlockedDecrement(&(esnl_ptr->ref));
+ return tmp;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_gettypeinfocount (ISensNetwork *This,
+ UINT *pctinfo)
+{
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_gettypeinfo (ISensNetwork *This,
+ UINT iTInfo,
+ LCID lcid,
+ ITypeInfo **ppTInfo)
+{
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_getidsofnames (ISensNetwork *This,
+ REFIID riid,
+ LPOLESTR *rgszNames,
+ UINT cNames,
+ LCID lcid,
+ DISPID *rgDispId)
+{
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_invoke (ISensNetwork *This,
+ DISPID dispIdMember,
+ REFIID riid,
+ LCID lcid,
+ WORD wFlags,
+ DISPPARAMS *pDispParams,
+ VARIANT *pVarResult,
+ EXCEPINFO *pExcepInfo,
+ UINT *puArgErr)
+{
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_connectionmade (ISensNetwork *This,
+ BSTR bstrConnection,
+ ULONG ulType,
+ LPSENS_QOCINFO lpQOCInfo)
+{
+ if (ulType) {
+ ESensNetworkListener *esnl_ptr=(ESensNetworkListener*)This;
+ EShell *shell = windows_sens_get_shell (esnl_ptr->ews_ptr);
+ /* Wait a second so that the connection stabilizes */
+ g_usleep(G_USEC_PER_SEC);
+ e_shell_set_network_available (shell, TRUE);
+ }
+ return S_OK;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_connectionmadenoqocinfo (ISensNetwork *This,
+ BSTR bstrConnection,
+ ULONG ulType)
+{
+ //Always followed by ConnectionMade
+ return S_OK;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_connectionlost (ISensNetwork *This,
+ BSTR bstrConnection,
+ ULONG ulType)
+{
+ if (ulType) {
+ ESensNetworkListener *esnl_ptr=(ESensNetworkListener*)This;
+ EShell *shell = windows_sens_get_shell (esnl_ptr->ews_ptr);
+ e_shell_set_network_available (shell, FALSE);
+ }
+ return S_OK;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_destinationreachable (ISensNetwork *This,
+ BSTR bstrDestination,
+ BSTR bstrConnection,
+ ULONG ulType,
+ LPSENS_QOCINFO lpQOCInfo)
+{
+ if (ulType) {
+ ESensNetworkListener *esnl_ptr=(ESensNetworkListener*)This;
+ EShell *shell = windows_sens_get_shell (esnl_ptr->ews_ptr);
+ /* Wait a second so that the connection stabilizes */
+ g_usleep(G_USEC_PER_SEC);
+ e_shell_set_network_available (shell, TRUE);
+ }
+ return S_OK;
+}
+
+static HRESULT WINAPI
+e_sens_network_listener_destinationreachablenoqocinfo (ISensNetwork *This,
+ BSTR bstrDestination,
+ BSTR bstrConnection,
+ ULONG ulType)
+{
+ return S_OK;
+}
+
+static void
+e_sens_network_listener_init(ESensNetworkListener **esnl_ptr,
+ EWindowsSENS *ews)
+{
+ (*esnl_ptr) = g_new0(ESensNetworkListener,1);
+ (*esnl_ptr)->lpVtbl = &ESensNetworkListenerVtbl;
+ (*esnl_ptr)->ews_ptr = ews;
+ (*esnl_ptr)->ref = 1;
+}
+
+
+static BSTR
+_mb2wchar (const char* a)
+{
+ static WCHAR b[64];
+ MultiByteToWideChar (0, 0, a, -1, b, 64);
+ return b;
+}
+
+static const char* add_curly_braces_to_uuid (const char* string_uuid)
+{
+ static char curly_braced_uuid_string[64];
+ int i;
+ if (!string_uuid)
+ return NULL;
+ lstrcpy(curly_braced_uuid_string,"{");
+ i = strlen(curly_braced_uuid_string);
+ lstrcat(curly_braced_uuid_string+i,string_uuid);
+ i = strlen(curly_braced_uuid_string);
+ lstrcat(curly_braced_uuid_string+i,"}");
+ return curly_braced_uuid_string;
+}
+
+static void
+windows_sens_constructed (GObject *object)
+{
+ HRESULT res;
+ static IEventSystem *pEventSystem =0;
+ static IEventSubscription* pEventSubscription = 0;
+ static ESensNetworkListener *pESensNetworkListener = 0;
+ static const char* eventclassid="{D5978620-5B9F-11D1-8DD2-00AA004ABD5E}";
+ static const char* methods[]={
+ "ConnectionMade",
+ "ConnectionMadeNoQOCInfo",
+ "ConnectionLost",
+ "DestinationReachable",
+ "DestinationReachableNoQOCInfo"
+ };
+ static const char* names[]={
+ "EWS_ConnectionMade",
+ "EWS_ConnectionMadeNoQOCInfo",
+ "EWS_ConnectionLost",
+ "EWS_DestinationReachable",
+ "EWS_DestinationReachableNoQOCInfo"
+ };
+ unsigned char* subids[] = { 0, 0, 0, 0, 0 };
+
+ EWindowsSENS *extension = (E_WINDOWS_SENS (object));
+ e_sens_network_listener_init(&pESensNetworkListener, extension);
+
+ CoInitialize(0);
+
+ res=CoCreateInstance (&CLSID_CEventSystem, 0,CLSCTX_SERVER,&IID_IEventSystem,(LPVOID*)&pEventSystem);
+
+ if (res == S_OK && pEventSystem) {
+
+ unsigned i;
+
+ for (i=0; i<G_N_ELEMENTS(methods); i++) {
+
+ res=CoCreateInstance (&CLSID_CEventSubscription, 0, CLSCTX_SERVER, &IID_IEventSubscription, (LPVOID*)&pEventSubscription);
+
+ if (res == S_OK && pEventSubscription) {
+ UUID tmp_uuid;
+ UuidCreate(&tmp_uuid);
+ UuidToString(&tmp_uuid, &subids[i]);
+ res=pEventSubscription->lpVtbl->put_SubscriptionID (pEventSubscription, _mb2wchar (add_curly_braces_to_uuid ((char*)subids[i])));
+ if (res) {
+ RpcStringFree (&subids[i]);
+ break;
+ }
+ RpcStringFree (&subids[i]);
+ res=pEventSubscription->lpVtbl->put_SubscriptionName (pEventSubscription, _mb2wchar (names[i]));
+ if (res)
+ break;
+ res=pEventSubscription->lpVtbl->put_MethodName (pEventSubscription, _mb2wchar (methods[i]));
+ if (res)
+ break;
+ res=pEventSubscription->lpVtbl->put_EventClassID (pEventSubscription, _mb2wchar (eventclassid));
+ if (res)
+ break;
+ res=pEventSubscription->lpVtbl->put_SubscriberInterface (pEventSubscription, (IUnknown*)pESensNetworkListener);
+ if (res)
+ break;
+ /* Make the subscription receive the event only if the owner of the subscription
+ * is logged on to the same computer as the publisher. This makes this module
+ * work with normal user account without administrative privileges.
+ */
+ res=pEventSubscription->lpVtbl->put_PerUser (pEventSubscription, TRUE);
+ if (res)
+ break;
+
+ res=pEventSystem->lpVtbl->Store (pEventSystem, (BSTR)PROGID_EventSubscription, (IUnknown*)pEventSubscription);
+ if (res)
+ break;
+ pEventSubscription->lpVtbl->Release (pEventSubscription);
+ pEventSubscription=0;
+ }
+ }
+ if (pEventSubscription)
+ pEventSubscription->lpVtbl->Release(pEventSubscription);
+ }
+
+ /* Do not try to get initial state when we are sure we will not get system events.
+ * Like that we don't get stuck with Disconnected status if we were disconnected
+ * on start.
+ */
+ if (res == S_OK) {
+
+ typedef BOOL (WINAPI* IsNetworkAlive_t) (LPDWORD);
+ BOOL alive = TRUE;
+ EShell *shell = windows_sens_get_shell (extension);
+
+ IsNetworkAlive_t pIsNetworkAlive = NULL;
+
+ HMODULE hDLL=LoadLibrary ("sensapi.dll");
+
+ if ((pIsNetworkAlive=(IsNetworkAlive_t) GetProcAddress (hDLL, "IsNetworkAlive"))) {
+ DWORD Network;
+ alive=pIsNetworkAlive (&Network);
+ }
+
+ FreeLibrary(hDLL);
+
+ e_shell_set_network_available (shell, alive);
+ }
+}
+
+static void
+e_windows_sens_class_init (EWindowsSENSClass *_class)
+{
+ GObjectClass *object_class;
+ EExtensionClass *extension_class;
+
+ object_class = G_OBJECT_CLASS (_class);
+ object_class->constructed = windows_sens_constructed;
+
+ extension_class = E_EXTENSION_CLASS (_class);
+ extension_class->extensible_type = E_TYPE_SHELL;
+}
+
+static void
+e_windows_sens_class_finalize (EWindowsSENSClass *_class)
+{
+}
+
+static void
+e_windows_sens_init (EWindowsSENS *extension)
+{
+}
+
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
+{
+ e_windows_sens_register_type (type_module);
+}
+
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
+{
+}
+
diff --git a/shell/e-shell-utils.c b/shell/e-shell-utils.c
index 81380d4d0a..12283b185c 100644
--- a/shell/e-shell-utils.c
+++ b/shell/e-shell-utils.c
@@ -76,6 +76,7 @@ e_shell_configure_web_view (EShell *shell,
shell_settings = e_shell_get_shell_settings (shell);
+#ifndef G_OS_WIN32
e_binding_new (
shell_settings, "disable-printing",
web_view, "disable-printing");
@@ -83,6 +84,7 @@ e_shell_configure_web_view (EShell *shell,
e_binding_new (
shell_settings, "disable-save-to-disk",
web_view, "disable-save-to-disk");
+#endif
}
/**
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index 0b44aa866e..eda1d9106b 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -358,6 +358,7 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
shell_window, "notify::active-view",
G_CALLBACK (e_shell_window_update_search_menu), NULL);
+#ifndef G_OS_WIN32
/* Support lockdown. */
action_group = ACTION_GROUP (LOCKDOWN_PRINTING);
@@ -377,6 +378,7 @@ e_shell_window_private_constructed (EShellWindow *shell_window)
e_binding_new_with_negation (
shell_settings, "disable-save-to-disk",
action_group, "visible");
+#endif
/* Bind GObject properties to GObject properties. */
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index d245437e84..beb865b98b 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -1122,6 +1122,7 @@ e_web_view_class_init (EWebViewClass *class)
PROP_COPY_TARGET_LIST,
"copy-target-list");
+#ifndef G_OS_WIN32
g_object_class_install_property (
object_class,
PROP_DISABLE_PRINTING,
@@ -1143,6 +1144,7 @@ e_web_view_class_init (EWebViewClass *class)
FALSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+#endif
g_object_class_install_property (
object_class,