make clipboard table operations static and remove unecessary includes

This commit is contained in:
Vincent Sanders 2014-02-01 12:41:23 +00:00
parent 1f62b5a980
commit 8bb0e87b1a
4 changed files with 15 additions and 24 deletions

View File

@ -1021,11 +1021,6 @@ uint32_t gtk_gui_gdkkey_to_nskey(GdkEventKey *key)
}
static struct gui_clipboard_table nsgtk_clipboard_table = {
.get = gui_get_clipboard,
.set = gui_set_clipboard,
};
static struct gui_browser_table nsgtk_browser_table = {
.poll = gui_poll,
@ -1048,7 +1043,7 @@ int main(int argc, char** argv)
struct gui_table nsgtk_gui_table = {
.browser = &nsgtk_browser_table,
.window = nsgtk_window_table,
.clipboard = &nsgtk_clipboard_table,
.clipboard = nsgtk_clipboard_table,
.download = nsgtk_download_table,
.fetch = nsgtk_fetch_table,
};

View File

@ -19,15 +19,11 @@
#ifndef NETSURF_GTK_SCAFFOLDING_H
#define NETSURF_GTK_SCAFFOLDING_H 1
#include <gtk/gtk.h>
#include <glib.h>
#include "content/hlcache.h"
#include "desktop/gui.h"
#include "desktop/plotters.h"
#include "gtk/menu.h"
#include "gtk/sexy_icon_entry.h"
#include <stdbool.h>
#include "utils/errors.h"
struct hlcache_handle;
struct gui_window;
typedef struct gtk_scaffolding nsgtk_scaffolding;
typedef enum {
@ -182,6 +178,6 @@ void gui_window_set_title(struct gui_window *g, const char *title);
void gui_window_set_url(struct gui_window *g, const char *url);
void gui_window_start_throbber(struct gui_window *g);
void gui_window_stop_throbber(struct gui_window *g);
void gui_set_search_ico(hlcache_handle *ico);
void gui_set_search_ico(struct hlcache_handle *ico);
#endif /* NETSURF_GTK_SCAFFOLDING_H */

View File

@ -23,7 +23,6 @@
#include "desktop/gui.h"
#include "desktop/browser.h"
#include "gtk/selection.h"
#include "gtk/window.h"
static GString *current_selection = NULL;
@ -36,7 +35,7 @@ static GtkClipboard *clipboard;
* \param buffer UTF-8 text, allocated by front end, ownership yeilded to core
* \param length Byte length of UTF-8 text in buffer
*/
void gui_get_clipboard(char **buffer, size_t *length)
static void gui_get_clipboard(char **buffer, size_t *length)
{
gchar *gtext;
@ -72,7 +71,7 @@ void gui_get_clipboard(char **buffer, size_t *length)
* \param styles Array of styles given to text runs, owned by core, or NULL
* \param n_styles Number of text run styles in array
*/
void gui_set_clipboard(const char *buffer, size_t length,
static void gui_set_clipboard(const char *buffer, size_t length,
nsclipboard_styles styles[], int n_styles)
{
clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
@ -88,3 +87,9 @@ void gui_set_clipboard(const char *buffer, size_t length,
gtk_clipboard_set_text(clipboard, current_selection->str, -1);
}
static struct gui_clipboard_table clipboard_table = {
.get = gui_get_clipboard,
.set = gui_set_clipboard,
};
struct gui_clipboard_table *nsgtk_clipboard_table = &clipboard_table;

View File

@ -19,11 +19,6 @@
#ifndef GTK_SELECTION_H
#define GTK_SELECTION_H
#include <gtk/gtk.h>
#include "desktop/gui.h"
void gui_get_clipboard(char **buffer, size_t *length);
void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles);
struct gui_clipboard_table *nsgtk_clipboard_table;
#endif