gtkieembed r206 - in trunk: . src



Author: hiikezoe
Date: Tue Feb  3 00:45:48 2009
New Revision: 206
URL: http://svn.gnome.org/viewvc/gtkieembed?rev=206&view=rev

Log:
	* src/gtk-ie-embed.[ch]: Added
	gtk_ie_embed_get_history_item_at_relative_position().
	* src/ie-bridge.[cpp|h]: Added
	_ie_bridge_get_history_item_at_relative_position().



Modified:
   trunk/ChangeLog
   trunk/src/gtk-ie-embed.c
   trunk/src/gtk-ie-embed.h
   trunk/src/ie-bridge.cpp
   trunk/src/ie-bridge.h

Modified: trunk/src/gtk-ie-embed.c
==============================================================================
--- trunk/src/gtk-ie-embed.c	(original)
+++ trunk/src/gtk-ie-embed.c	Tue Feb  3 00:45:48 2009
@@ -788,6 +788,14 @@
     return priv->bridge ? _ie_bridge_get_current_position_in_history (priv->bridge) : 0;
 }
 
+GtkIEEmbedHistoryItem *
+gtk_ie_embed_get_history_item_at_relative_position (GtkIEEmbed *ie, gint position)
+{
+    GtkIEEmbedPriv *priv = GTK_IE_EMBED_GET_PRIVATE (ie);
+
+    return priv->bridge ? _ie_bridge_get_history_item_at_relative_position (priv->bridge, position) : 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	Tue Feb  3 00:45:48 2009
@@ -168,6 +168,10 @@
                                          (GtkIEEmbed *ie);
 guint        gtk_ie_embed_get_current_position_in_history
                                          (GtkIEEmbed *ie);
+GtkIEEmbedHistoryItem *
+             gtk_ie_embed_get_history_item_at_relative_position
+                                         (GtkIEEmbed *ie,
+                                          gint position);
 /* event target */
 const gchar *gtk_ie_embed_dom_event_target_get_name
                                          (GtkIEEmbedDOMEventTarget *target);

Modified: trunk/src/ie-bridge.cpp
==============================================================================
--- trunk/src/ie-bridge.cpp	(original)
+++ trunk/src/ie-bridge.cpp	Tue Feb  3 00:45:48 2009
@@ -1214,6 +1214,31 @@
 }
 #endif
 
+#ifdef HAVE_TLOGSTG_H
+static GtkIEEmbedHistoryItem *
+travel_log_entry_to_history_item (ITravelLogEntry *entry)
+{
+    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);
+
+    g_free (uri);
+    g_free (title);
+    CoTaskMemFree (szURL);
+    CoTaskMemFree (szTitle);
+
+    return history_item;
+}
+
+#endif
+
 GList *
 _ie_bridge_get_history (IEBridge *ie, GtkIEEmbedHistoryDirection direction)
 {
@@ -1237,22 +1262,11 @@
     }
     
     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_item = travel_log_entry_to_history_item(entry);
         history = g_list_append (history, history_item);
 
-        g_free (uri);
-        g_free (title);
-        CoTaskMemFree (szURL);
-        CoTaskMemFree (szTitle);
         entry->Release ();
         entry = NULL;
     }
@@ -1342,6 +1356,28 @@
     return (guint)count;
 }
 
+GtkIEEmbedHistoryItem *
+_ie_bridge_get_history_item_at_relative_position (IEBridge *ie, gint position)
+{
+    GtkIEEmbedHistoryItem *item = NULL;
+#ifdef HAVE_TLOGSTG_H
+    ITravelLogStg *travel_log = NULL;
+    ITravelLogEntry *entry = NULL;
+
+    travel_log = _get_travel_log (ie);
+    if (!travel_log)
+        return NULL;
+
+    travel_log->GetRelativeEntry (position, &entry);
+    if (entry) {
+        item = travel_log_entry_to_history_item (entry);
+        entry->Release ();
+    }
+    travel_log->Release ();
+#endif
+    return item;
+}
+
 
 /*
 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	Tue Feb  3 00:45:48 2009
@@ -155,6 +155,10 @@
                                         (IEBridge *ie);
 guint       _ie_bridge_get_current_position_in_history
                                         (IEBridge *ie);
+GtkIEEmbedHistoryItem *
+            _ie_bridge_get_history_item_at_relative_position
+                                        (IEBridge *ie,
+                                         gint position);
 G_END_DECLS
 
 #endif /* __IE_BRIDGE_H__ */



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