void
midori_transferbar_add_download_item (MidoriTransferbar* transferbar,
WebKitDownload* download);
+void
+midori_transferbar_check_size (GtkWidget* statusbar,
+ MidoriTransferbar* transferbar);
#define _action_by_name(brwsr, nme) \
gtk_action_group_get_action (brwsr->action_group, nme)
webkit_download_set_destination_uri (download, uri);
g_signal_emit (browser, signals[ADD_DOWNLOAD], 0, download);
midori_transferbar_add_download_item (MIDORI_TRANSFERBAR (browser->transferbar), download);
+ midori_transferbar_check_size (browser->statusbar,
+ MIDORI_TRANSFERBAR (browser->transferbar));
return TRUE;
}
}
}
+void
+midori_transferbar_check_size (GtkWidget* statusbar,
+ MidoriTransferbar* transferbar)
+{
+ GtkWidget* window;
+ GtkRequisition req;
+ gint reqwidth, winwidth;
+ gtk_widget_size_request (statusbar, &req);
+ reqwidth = req.width;
+ window = gtk_widget_get_toplevel (GTK_WIDGET(transferbar));
+ gtk_window_get_size (GTK_WINDOW(window), &winwidth, NULL);
+
+ if (reqwidth > winwidth)
+ {
+ GList* list;
+ for (list = transferbar->infos; list != NULL; list = g_list_next (list))
+ {
+ TransferInfo* info = list->data;
+ WebKitDownloadStatus status = webkit_download_get_status (info->download);
+ if (status == WEBKIT_DOWNLOAD_STATUS_ERROR
+ || status == WEBKIT_DOWNLOAD_STATUS_CANCELLED
+ || status == WEBKIT_DOWNLOAD_STATUS_FINISHED)
+ {
+ gtk_widget_destroy (info->button);
+ }
+ }
+ }
+}
+
void
midori_transferbar_add_download_item (MidoriTransferbar* transferbar,
WebKitDownload* download)