gtkieembed r203 - in trunk: . src



Author: hiikezoe
Date: Mon Feb  2 06:28:46 2009
New Revision: 203
URL: http://svn.gnome.org/viewvc/gtkieembed?rev=203&view=rev

Log:
	* src/gtk-ie-embed.[ch]: Added gtk_ie_embed_get_backward_history() and
	gtk_ie_embed_get_forward_history().
	* src/ie-bridge.[cpp|h]: Added ie_bridge_get_history().



Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/gtk-ie-embed-history-item.h
   trunk/src/gtk-ie-embed.c
   trunk/src/gtk-ie-embed.h
   trunk/src/ie-bridge.cpp
   trunk/src/ie-bridge.h

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Mon Feb  2 06:28:46 2009
@@ -189,6 +189,12 @@
 esac
 AM_CONDITIONAL([HAVE_WINDRES], [test x"$WINDRES" != x])
 
+gtk_ie_embed_save_cppflags="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -Isrc"
+AC_CHECK_HEADER(tlogstg.h,
+                [AC_DEFINE(HAVE_TLOGSTG_H, 1, [Define to 1 if tlogstg.h is available.])])
+CPPFLAGS="$gtk_ie_embed_save_cppflags"
+
 dnl **************************************************************
 dnl Check for Cutter
 dnl **************************************************************

Modified: trunk/src/gtk-ie-embed-history-item.h
==============================================================================
--- trunk/src/gtk-ie-embed-history-item.h	(original)
+++ trunk/src/gtk-ie-embed-history-item.h	Mon Feb  2 06:28:46 2009
@@ -31,6 +31,11 @@
 #define GTK_IS_IE_EMBED_HISTORY_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IE_EMBED_HISTORY_ITEM))
 #define GTK_IE_EMBED_HISTORY_ITEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_IE_EMBED_HISTORY_ITEM, GtkIEEmbedHistoryItemClass))
 
+typedef enum {
+    GTK_IE_EMBED_HISTORY_FORWARD,
+    GTK_IE_EMBED_HISTORY_BACKWARD
+} GtkIEEmbedHistoryDirection;
+
 typedef struct _GtkIEEmbedHistoryItem GtkIEEmbedHistoryItem;
 typedef struct _GtkIEEmbedHistoryItemClass GtkIEEmbedHistoryItemClass;
 

Modified: trunk/src/gtk-ie-embed.c
==============================================================================
--- trunk/src/gtk-ie-embed.c	(original)
+++ trunk/src/gtk-ie-embed.c	Mon Feb  2 06:28:46 2009
@@ -740,6 +740,22 @@
     return GTK_IE_EMBED_GET_PRIVATE (ie)->use_context_menu;
 }
 
+GList *
+gtk_ie_embed_get_backward_history (GtkIEEmbed *ie)
+{
+    GtkIEEmbedPriv *priv = GTK_IE_EMBED_GET_PRIVATE (ie);
+
+    return priv->bridge ? _ie_bridge_get_history (priv->bridge, GTK_IE_EMBED_HISTORY_BACKWARD) : NULL;
+}
+
+GList *
+gtk_ie_embed_get_forward_history (GtkIEEmbed *ie)
+{
+    GtkIEEmbedPriv *priv = GTK_IE_EMBED_GET_PRIVATE (ie);
+
+    return priv->bridge ? _ie_bridge_get_history (priv->bridge, GTK_IE_EMBED_HISTORY_FORWARD) : NULL;
+}
+
 const gchar *
 gtk_ie_embed_dom_event_target_get_name (GtkIEEmbedDOMEventTarget *target)
 {

Modified: trunk/src/gtk-ie-embed.h
==============================================================================
--- trunk/src/gtk-ie-embed.h	(original)
+++ trunk/src/gtk-ie-embed.h	Mon Feb  2 06:28:46 2009
@@ -21,6 +21,7 @@
 #define __GTK_IE_EMBED_H__
 
 #include <gtk/gtk.h>
+#include <gtk-ie-embed-history-item.h>
 
 G_BEGIN_DECLS
 
@@ -153,6 +154,10 @@
                                           gboolean use);
 gboolean    gtk_ie_embed_get_use_context_menu
                                          (GtkIEEmbed *ie);
+GList       *gtk_ie_embed_get_backward_history
+                                         (GtkIEEmbed *ie);
+GList       *gtk_ie_embed_get_forward_history
+                                         (GtkIEEmbed *ie);
 
 /* event target */
 const gchar *gtk_ie_embed_dom_event_target_get_name

Modified: trunk/src/ie-bridge.cpp
==============================================================================
--- trunk/src/ie-bridge.cpp	(original)
+++ trunk/src/ie-bridge.cpp	Mon Feb  2 06:28:46 2009
@@ -17,6 +17,10 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif /* HAVE_CONFIG_H */
+
 #include "ie-bridge.h"
 
 #include <gdk/gdkwin32.h>
@@ -24,9 +28,14 @@
 #include <exdisp.h>
 #include <unknwn.h>
 #include <mshtml.h>
+#include <servprov.h>
+#ifdef HAVE_TLOGSTG_H
+#include <tlogstg.h>
+#endif
 
 #include "gtk-ie-embed.h"
 #include "gtk-ie-embed-private.h"
+#include "gtk-ie-embed-history-item.h"
 #include "ie-browser-event-dispatcher.h"
 #include "ie-document-event-dispatcher.h"
 #include "ie-utils.h"
@@ -59,6 +68,10 @@
 static HMODULE hModule = NULL;
 static ATLAXGETCONTROL AtlAxGetControl = NULL;
 
+#ifdef HAVE_TLOGSTG_H
+const GUID IID_ITravelLogStg = {0x7ebfdd80, 0xad18, 0x11d3, 0xa4,0xc5, 0x00,0xc0,0x4f,0x72,0xd6,0xb8};
+#endif
+
 /* virtual functions for GtkObject class */
 static GObject *constructor        (GType                  type,
                                     guint                  n_props,
@@ -1181,6 +1194,57 @@
     collection->Release ();
 }
 
+GList *
+_ie_bridge_get_history (IEBridge *ie, GtkIEEmbedHistoryDirection direction)
+{
+    GList *history = NULL;
+#ifdef HAVE_TLOGSTG_H
+    IServiceProvider *service_provider = NULL;    
+    ITravelLogStg *travel_log = NULL;
+    IEnumTravelLogEntry *enum_entry = NULL;
+    ITravelLogEntry *entry = NULL;
+    IEBridgePriv *priv = IE_BRIDGE_GET_PRIVATE (ie);
+    TLENUMF direction_flags = (direction == GTK_IE_EMBED_HISTORY_FORWARD) ? TLEF_RELATIVE_FORE : TLEF_RELATIVE_BACK;
+
+    if (!priv->web_browser)
+        return NULL;
+
+    priv->web_browser->QueryInterface (IID_IServiceProvider, (void**) &service_provider);
+    if (!service_provider)
+        return NULL;
+
+    service_provider->QueryService (SID_STravelLogCursor, IID_ITravelLogStg, (void**) &travel_log);
+    if (!travel_log)
+        return NULL;
+
+    travel_log->EnumEntries (direction_flags, &enum_entry);
+    if (!enum_entry)
+        return NULL;
+    
+    while (enum_entry->Next (1, &entry, NULL) != S_FALSE) {
+        LPOLESTR szURL, szTitle;
+        gchar *uri, *title;
+        GtkIEEmbedHistoryItem *history_item;
+
+        entry->GetURL(&szURL);
+        entry->GetTitle(&szTitle);
+
+        uri = g_utf16_to_utf8((gunichar2*) szURL, -1, NULL, NULL, NULL);
+        title = g_utf16_to_utf8((gunichar2*) szTitle, -1, NULL, NULL, NULL);
+        history_item = gtk_ie_embed_history_item_new(uri, title);
+        history = g_list_append (history, history_item);
+
+        g_free(uri);
+        g_free(title);
+        CoTaskMemFree(szURL);
+        CoTaskMemFree(szTitle);
+        entry->Release();
+        entry = NULL;
+    }
+#endif
+    return history;
+}
+
 /*
 vi:ts=4:nowrap:ai:expandtab:sw=4
 */

Modified: trunk/src/ie-bridge.h
==============================================================================
--- trunk/src/ie-bridge.h	(original)
+++ trunk/src/ie-bridge.h	Mon Feb  2 06:28:46 2009
@@ -146,6 +146,8 @@
 void        _ie_bridge_selection_changed
                                         (IEBridge *ie);
 void        _ie_bridge_load_favicon     (IEBridge *ie);
+GList      *_ie_bridge_get_history      (IEBridge *ie,
+                                         GtkIEEmbedHistoryDirection direction);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]