aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-09-13 18:24:56 +0800
committerChristian Persch <chpe@src.gnome.org>2004-09-13 18:24:56 +0800
commit2606279995f614634062e0aeb9833c482db5d083 (patch)
tree625e6ae5d03052e753c3322397b41f4174ca3926 /embed
parent79ec35d68d698710604fd4e9682188ae28ba1ae0 (diff)
downloadgsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.gz
gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.tar.zst
gsoc2013-epiphany-2606279995f614634062e0aeb9833c482db5d083.zip
Merging pre-gnome-2-10 branch to HEAD.
2004-09-13 Christian Persch <chpe@cvs.gnome.org> Merging pre-gnome-2-10 branch to HEAD. Splitting ChangeLog.
Diffstat (limited to 'embed')
-rw-r--r--embed/downloader-view.c63
-rw-r--r--embed/ephy-download.h1
-rw-r--r--embed/ephy-embed-factory.c71
-rw-r--r--embed/ephy-embed-factory.h4
-rw-r--r--embed/ephy-embed-shell.c2
-rw-r--r--embed/ephy-encodings.c15
-rw-r--r--embed/ephy-encodings.h18
-rw-r--r--embed/ephy-favicon-cache.c2
-rw-r--r--embed/mozilla/EventContext.cpp5
-rw-r--r--embed/mozilla/MozDownload.cpp2
10 files changed, 77 insertions, 106 deletions
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index fd6611716..2029a701c 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -26,7 +26,6 @@
#include "downloader-view.h"
#include "ephy-file-helpers.h"
#include "ephy-embed-shell.h"
-#include "ephy-cell-renderer-progress.h"
#include "ephy-stock-icons.h"
#include <libgnomevfs/gnome-vfs-utils.h>
@@ -37,6 +36,7 @@
#include <gtk/gtkbutton.h>
#include <gtk/gtkcellrenderertext.h>
#include <gtk/gtkcellrendererpixbuf.h>
+#include <gtk/gtkcellrendererprogress.h>
#include <gtk/gtktreeselection.h>
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtkicontheme.h>
@@ -48,6 +48,7 @@
enum
{
+ COL_STATE,
COL_PERCENT,
COL_IMAGE,
COL_FILE,
@@ -57,7 +58,7 @@ enum
enum
{
- PERCENT_COL_POS,
+ PROGRESS_COL_POS,
FILE_COL_POS,
REMAINING_COL_POS
};
@@ -299,10 +300,10 @@ update_download_row (DownloaderView *dv, EphyDownload *download)
GtkTreePath *path;
GtkTreeIter iter;
EphyDownloadState state;
- long total, current, remaining_secs;
+ long total, current, remaining_secs = 0;
char *remaining, *file, *cur_progress, *name;
struct tm;
- int percent;
+ int percent = 0;
row_ref = get_row_from_download (dv, download);
g_return_if_fail (row_ref != NULL);
@@ -311,21 +312,15 @@ update_download_row (DownloaderView *dv, EphyDownload *download)
state = ephy_download_get_state (download);
switch (state)
{
- case EPHY_DOWNLOAD_FAILED:
- percent = -2;
- remaining_secs = 0;
- break;
case EPHY_DOWNLOAD_COMPLETED:
downloader_view_remove_download (dv, download);
return;
+ case EPHY_DOWNLOAD_PAUSED:
case EPHY_DOWNLOAD_DOWNLOADING:
- case EPHY_DOWNLOAD_PAUSED:
percent = ephy_download_get_percent (download);
remaining_secs = ephy_download_get_remaining_time (download);
break;
default:
- percent = 0;
- remaining_secs = 0;
break;
}
@@ -363,6 +358,7 @@ update_download_row (DownloaderView *dv, EphyDownload *download)
gtk_tree_model_get_iter (dv->priv->model, &iter, path);
gtk_list_store_set (GTK_LIST_STORE (dv->priv->model),
&iter,
+ COL_STATE, state,
COL_PERCENT, percent,
COL_FILE, file,
COL_REMAINING, remaining,
@@ -519,6 +515,38 @@ selection_changed (GtkTreeSelection *selection, DownloaderView *dv)
}
static void
+progress_cell_data_func (GtkTreeViewColumn *col,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ EphyDownloadState state;
+ int percent;
+
+ gtk_tree_model_get (model, iter,
+ COL_STATE, &state,
+ COL_PERCENT, &percent,
+ -1);
+
+ switch (state)
+ {
+ case EPHY_DOWNLOAD_INITIALISING:
+ g_object_set (renderer, "text", Q_("download status|Unknown"), NULL);
+ break;
+ case EPHY_DOWNLOAD_FAILED:
+ g_object_set (renderer, "text", Q_("download status|Failed"), NULL);
+ break;
+ case EPHY_DOWNLOAD_DOWNLOADING:
+ case EPHY_DOWNLOAD_PAUSED:
+ g_object_set (renderer, "text", NULL, "value", percent, NULL);
+ break;
+ default:
+ g_return_if_reached ();
+ }
+}
+
+static void
downloader_view_build_ui (DownloaderView *dv)
{
DownloaderViewPrivate *priv = dv->priv;
@@ -544,7 +572,8 @@ downloader_view_build_ui (DownloaderView *dv)
gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)),
GTK_SELECTION_BROWSE);
- liststore = gtk_list_store_new (5,
+ liststore = gtk_list_store_new (6,
+ G_TYPE_INT,
G_TYPE_INT,
GDK_TYPE_PIXBUF,
G_TYPE_STRING,
@@ -576,15 +605,15 @@ downloader_view_build_ui (DownloaderView *dv)
gtk_tree_view_column_set_sort_column_id (column, COL_FILE);
gtk_tree_view_column_set_spacing (column, 3);
- /* Percent column */
- renderer = ephy_cell_renderer_progress_new ();
+ /* Progress column */
+ renderer = gtk_cell_renderer_progress_new ();
g_object_set (renderer, "xalign", 0.5, NULL);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview),
- PERCENT_COL_POS, _("%"),
+ PROGRESS_COL_POS, _("%"),
renderer,
- "value", COL_PERCENT,
NULL);
- column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview), PERCENT_COL_POS);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview), PROGRESS_COL_POS);
+ gtk_tree_view_column_set_cell_data_func(column, renderer, progress_cell_data_func, NULL, NULL);
gtk_tree_view_column_set_sort_column_id (column, COL_PERCENT);
/* Remainng time column */
diff --git a/embed/ephy-download.h b/embed/ephy-download.h
index 749c55213..64d483b2a 100644
--- a/embed/ephy-download.h
+++ b/embed/ephy-download.h
@@ -39,6 +39,7 @@ typedef struct EphyDownloadPrivate EphyDownloadPrivate;
typedef enum
{
+ EPHY_DOWNLOAD_INITIALISING,
EPHY_DOWNLOAD_DOWNLOADING,
EPHY_DOWNLOAD_PAUSED,
EPHY_DOWNLOAD_COMPLETED,
diff --git a/embed/ephy-embed-factory.c b/embed/ephy-embed-factory.c
index 5a81004f0..ef382c9eb 100644
--- a/embed/ephy-embed-factory.c
+++ b/embed/ephy-embed-factory.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 Marco Pesenti Gritti
+ * Copyright (C) 2000-2004 Marco Pesenti Gritti
*
* 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
@@ -26,68 +26,39 @@
#include "mozilla-embed.h"
#include "mozilla-embed-persist.h"
#include "mozilla-embed-single.h"
+#include "ephy-embed.h"
+#include "ephy-embed-persist.h"
+#include "ephy-embed-single.h"
-#include <string.h>
-
-typedef enum
-{
- EPHY_EMBED_OBJECT,
- EPHY_EMBED_PERSIST_OBJECT,
- EPHY_EMBED_SINGLE_OBJECT
-} EmbedObjectType;
-
-static EmbedObjectType
-type_from_id (const char *object_id)
+/**
+ * ephy_embed_factory_new_object:
+ * @type: a #GType specifying which object to create
+ *
+ * Create an instance of an object implementing the @type interface.
+ *
+ * Return value: the object instance
+ **/
+GObject *
+ephy_embed_factory_new_object (GType type)
{
- EmbedObjectType result = 0;
+ GObject *object = NULL;
- if (strcmp (object_id, "EphyEmbed") == 0)
+ if (type == EPHY_TYPE_EMBED)
{
- result = EPHY_EMBED_OBJECT;
+ object = g_object_new (MOZILLA_TYPE_EMBED, NULL);
}
- else if (strcmp (object_id, "EphyEmbedPersist") == 0)
+ else if (type == EPHY_TYPE_EMBED_PERSIST)
{
- result = EPHY_EMBED_PERSIST_OBJECT;
+ object = g_object_new (MOZILLA_TYPE_EMBED_PERSIST, NULL);
}
- else if (strcmp (object_id, "EphyEmbedSingle") == 0)
+ else if (type == EPHY_TYPE_EMBED_SINGLE)
{
- result = EPHY_EMBED_SINGLE_OBJECT;
+ object = g_object_new (MOZILLA_TYPE_EMBED_SINGLE, NULL);
}
else
{
g_assert_not_reached ();
}
- return result;
-}
-
-/**
- * ephy_embed_factory_new_object:
- * @object_id: identifier of the object to create
- *
- * Create an instance of the object identified by @object_id.
- *
- * Return value: the object instance
- **/
-GObject *
-ephy_embed_factory_new_object (const char *object_id)
-{
- GObject *object;
-
- switch (type_from_id (object_id))
- {
- case EPHY_EMBED_OBJECT:
- object = g_object_new (MOZILLA_TYPE_EMBED, NULL);
- break;
- case EPHY_EMBED_PERSIST_OBJECT:
- object = g_object_new (MOZILLA_TYPE_EMBED_PERSIST, NULL);
- break;
- case EPHY_EMBED_SINGLE_OBJECT:
- object = g_object_new (MOZILLA_TYPE_EMBED_SINGLE, NULL);
- break;
- default:
- object = NULL;
- }
-
return object;
}
diff --git a/embed/ephy-embed-factory.h b/embed/ephy-embed-factory.h
index 9c8425f7d..9d4774147 100644
--- a/embed/ephy-embed-factory.h
+++ b/embed/ephy-embed-factory.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 Marco Pesenti Gritti
+ * Copyright (C) 2000-2004 Marco Pesenti Gritti
*
* 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
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-GObject *ephy_embed_factory_new_object (const char *object_id);
+GObject *ephy_embed_factory_new_object (GType type);
G_END_DECLS
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 28c3706ff..1bb7c637d 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -189,7 +189,7 @@ ephy_embed_shell_get_embed_single (EphyEmbedShell *shell)
if (shell->priv->embed_single == NULL)
{
shell->priv->embed_single = EPHY_EMBED_SINGLE
- (ephy_embed_factory_new_object ("EphyEmbedSingle"));
+ (ephy_embed_factory_new_object (EPHY_TYPE_EMBED_SINGLE));
}
return G_OBJECT (shell->priv->embed_single);
diff --git a/embed/ephy-encodings.c b/embed/ephy-encodings.c
index b58fbd9e5..868391c29 100644
--- a/embed/ephy-encodings.c
+++ b/embed/ephy-encodings.c
@@ -484,21 +484,6 @@ ephy_encodings_init (EphyEncodings *encodings)
g_slist_free (list);
}
-void
-ephy_encoding_info_free (EphyEncodingInfo *info)
-{
- if (info)
- {
- g_free (info->encoding);
- g_free (info->hint_encoding);
- g_free (info->parent_encoding);
- g_free (info->prev_doc_encoding);
- g_free (info->forced_encoding);
- g_free (info->default_encoding);
- g_free (info);
- }
-}
-
EphyEncodings *
ephy_encodings_new (void)
{
diff --git a/embed/ephy-encodings.h b/embed/ephy-encodings.h
index bb8dfea58..265c827eb 100644
--- a/embed/ephy-encodings.h
+++ b/embed/ephy-encodings.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003 Christian Persch
+ * Copyright (C) 2003, 2004 Christian Persch
*
* 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
@@ -88,20 +88,6 @@ typedef enum
}
EphyEncodingSource;
-typedef struct
-{
- char *encoding;
- char *default_encoding;
- char *hint_encoding;
- char *prev_doc_encoding;
- char *forced_encoding;
- char *parent_encoding;
- EphyEncodingSource encoding_source;
- EphyEncodingSource hint_encoding_source;
- EphyEncodingSource parent_encoding_source;
-}
-EphyEncodingInfo;
-
enum
{
EPHY_NODE_ENCODING_PROP_TITLE = 1,
@@ -145,8 +131,6 @@ void ephy_encodings_add_recent (EphyEncodings *encodings,
GList *ephy_encodings_get_recent (EphyEncodings *encodings);
-void ephy_encoding_info_free (EphyEncodingInfo *info);
-
G_END_DECLS
#endif
diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c
index 1854c6813..6d012d322 100644
--- a/embed/ephy-favicon-cache.c
+++ b/embed/ephy-favicon-cache.c
@@ -376,7 +376,7 @@ ephy_favicon_cache_download (EphyFaviconCache *cache,
dest = g_build_filename (cache->priv->directory, filename, NULL);
persist = EPHY_EMBED_PERSIST
- (ephy_embed_factory_new_object ("EphyEmbedPersist"));
+ (ephy_embed_factory_new_object (EPHY_TYPE_EMBED_PERSIST));
ephy_embed_persist_set_dest (persist, dest);
ephy_embed_persist_set_flags (persist, EMBED_PERSIST_NO_VIEW);
diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp
index 1f7d27bd4..c3891bc5f 100644
--- a/embed/mozilla/EventContext.cpp
+++ b/embed/mozilla/EventContext.cpp
@@ -653,8 +653,9 @@ nsresult EventContext::GetMouseEventInfo (nsIDOMMouseEvent *aMouseEvent, Mozilla
aMouseEvent->GetShiftKey(&mod_key);
if (mod_key) info->modifier |= GDK_SHIFT_MASK;
- aMouseEvent->GetMetaKey(&mod_key);
- if (mod_key) info->modifier |= GDK_MOD2_MASK;
+ /* no need to check GetMetaKey, it's always PR_FALSE,
+ * see widget/src/gtk2/nsWindow.cpp:InitMouseEvent
+ */
aMouseEvent->GetCtrlKey(&mod_key);
if (mod_key) info->modifier |= GDK_CONTROL_MASK;
diff --git a/embed/mozilla/MozDownload.cpp b/embed/mozilla/MozDownload.cpp
index 9070b6caa..7e25a1faa 100644
--- a/embed/mozilla/MozDownload.cpp
+++ b/embed/mozilla/MozDownload.cpp
@@ -69,7 +69,7 @@ MozDownload::MozDownload() :
mMaxSize(-1),
mStatus(NS_OK),
mEmbedPersist(nsnull),
- mDownloadState(EPHY_DOWNLOAD_DOWNLOADING)
+ mDownloadState(EPHY_DOWNLOAD_INITIALISING)
{
LOG ("MozDownload ctor (%p)", (void *) this)
}