Here are some more comments for Mike for the most recent checkins.
B.
+bool nsgtk_check_for_downloads (GtkWindow *parent)
+{
+ if (nsgtk_downloads != 0) {
+ GtkWidget *dialog;
+ dialog = gtk_message_dialog_new_with_markup(parent,
+ GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ "<big><b>Quit NetSurf?</b></big>\n\n"
+ "<small>There are still downloads running, "
+ "if you quit now these will be canceled and the"
+ " files deleted</small>");
+ gtk_dialog_add_buttons(GTK_DIALOG(dialog), "gtk-cancel",
+ GTK_RESPONSE_CANCEL, "gtk-quit",
+ GTK_RESPONSE_CLOSE, NULL);
+
+ gint response = gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+
+ if (response == GTK_RESPONSE_CANCEL)
+ return true;
+ }
+}
i18n needed here.
+struct gui_download_window *gui_download_window_create(const char *url,
+ const char *mime_type, struct fetch *fetch,
+ unsigned int total_size, struct gui_window *gui)
+{
+ nsgtk_download_parent = nsgtk_scaffolding_get_window(gui);
+ struct gui_download_window *download;
+ gchar *domain;
+ gchar *filename;
+ gchar *destination;
+ gchar *size = (total_size == 0 ?
+ "Unknown" : human_friendly_bytesize(total_size));
i18n.
-void nsgtk_downloadPause_clicked(GtkToolButton *button, gpointer data)
+void nsgtk_download_store_create_item (struct gui_download_window *dl)
{
+ nsgtk_download_store_update_item(dl);
+ /* The iter has already been updated to this row */
+ gtk_list_store_set (nsgtk_download_store, &nsgtk_download_iter,
+ NSGTK_DOWNLOAD, dl, -1);
+}
Style - remove space after function name.
+gchar* nsgtk_download_info_to_string (struct gui_download_window *dl)
+{
+ if (dl->status != NSGTK_DOWNLOAD_ERROR)
+ return g_strdup_printf("%s\n%s of %s completed",
+ dl->name->str,
+ human_friendly_bytesize(dl->size_downloaded),
+ dl->size_total == 0 ? "Unknown" :
+ human_friendly_bytesize(dl->size_total));
+ else
+ return g_strdup_printf("%s\n%s", dl->name->str,
+ dl->error->message);
+}
i18n.
Index: gtk/gtk_download.h
===================================================================
--- gtk/gtk_download.h (revision 4680)
+++ gtk/gtk_download.h (working copy)
+typedef void (*selection_action)(struct gui_download_window *dl);
Namespace this type.
Index: gtk/gtk_gui.c
===================================================================
--- gtk/gtk_gui.c (revision 4680)
+++ gtk/gtk_gui.c (working copy)
+
+ if (!option_downloads_directory) {
Missing explicit check for NULL.
+ char *home = getenv("HOME");
+ LOG(("Using '%s' as download directory", home));
+ option_downloads_directory = home;
+ }
Index: gtk/gtk_selection.c
===================================================================
--- gtk/gtk_selection.c (revision 4680)
+++ gtk/gtk_selection.c (working copy)
+static GString *current_selection = NULL;
+static GtkClipboard *clipboard;
Namespace.
@@ -80,18 +85,26 @@
char *text;
clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
text = gtk_clipboard_wait_for_text (clipboard);
+ /* clipboard_wait... converts the string to utf8 for us */
+ if (text != NULL)
+ browser_window_paste_text(g->bw, text, strlen(text), true);
+ free(text);
Should this be g_free() ?
bool gui_commit_clipboard(void)
{
+ clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_set_text (clipboard, current_selection->str, -1);
return true;
}
Style - space after function names.