Created SugarBrowserChandler, for signaling when the browser has downloaded a file that cannot handle himself.
parent
60fd7fb810
commit
dade0fbabc
@ -0,0 +1,57 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sugar-marshal.h"
|
||||
#include "sugar-browser-chandler.h"
|
||||
|
||||
G_DEFINE_TYPE(SugarBrowserChandler, sugar_browser_chandler, G_TYPE_OBJECT)
|
||||
|
||||
SugarBrowserChandler *browserChandler = NULL;
|
||||
|
||||
static void
|
||||
sugar_browser_chandler_init(SugarBrowserChandler *browserChandler)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
sugar_browser_chandler_class_init(SugarBrowserChandlerClass *browser_chandler_class)
|
||||
{
|
||||
browser_chandler_class->handle_content_signal_id =
|
||||
g_signal_new ("handle-content",
|
||||
G_OBJECT_CLASS_TYPE (browser_chandler_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (SugarBrowserChandlerClass, handle_content),
|
||||
NULL, NULL,
|
||||
sugar_marshal_VOID__STRING_STRING_STRING_STRING,
|
||||
G_TYPE_NONE, 4,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_STRING);
|
||||
}
|
||||
|
||||
SugarBrowserChandler *
|
||||
sugar_get_browser_chandler()
|
||||
{
|
||||
if(browserChandler == NULL)
|
||||
browserChandler = g_object_new(SUGAR_TYPE_BROWSER_CHANDLER, NULL);
|
||||
|
||||
return browserChandler;
|
||||
}
|
||||
|
||||
void
|
||||
sugar_browser_chandler_handle_content (SugarBrowserChandler *browser_chandler,
|
||||
const char *url,
|
||||
const char *suggested_file_name,
|
||||
const char *mime_type,
|
||||
const char *tmp_file_name)
|
||||
{
|
||||
g_signal_emit(browser_chandler,
|
||||
SUGAR_BROWSER_CHANDLER_GET_CLASS(
|
||||
browser_chandler)->handle_content_signal_id,
|
||||
0 /* details */,
|
||||
url,
|
||||
suggested_file_name,
|
||||
mime_type,
|
||||
tmp_file_name);
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
#ifndef __SUGAR_BROWSER_CHANDLER_H__
|
||||
#define __SUGAR_BROWSER_CHANDLER_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _SugarBrowserChandler SugarBrowserChandler;
|
||||
typedef struct _SugarBrowserChandlerClass SugarBrowserChandlerClass;
|
||||
|
||||
#define SUGAR_TYPE_BROWSER_CHANDLER ( \
|
||||
sugar_browser_chandler_get_type())
|
||||
#define SUGAR_BROWSER_CHANDLER(object) ( \
|
||||
G_TYPE_CHECK_INSTANCE_CAST((object), \
|
||||
SUGAR_TYPE_BROWSER_CHANDLER, SugarBrowserChandler))
|
||||
#define SUGAR_BROWSER_CHANDLER_CLASS(klass) ( \
|
||||
G_TYPE_CHECK_CLASS_CAST((klass), \
|
||||
SUGAR_TYPE_BROWSER_CHANDLER, \
|
||||
SugarBrowserChandlerClass))
|
||||
#define SUGAR_IS_BROWSER_CHANDLER(object) ( \
|
||||
G_TYPE_CHECK_INSTANCE_TYPE((object), \
|
||||
SUGAR_TYPE_BROWSER_CHANDLER))
|
||||
#define SUGAR_IS_BROWSER_CHANDLER_CLASS(klass) ( \
|
||||
G_TYPE_CHECK_CLASS_TYPE((klass), \
|
||||
SUGAR_TYPE_BROWSER_CHANDLER))
|
||||
#define SUGAR_BROWSER_CHANDLER_GET_CLASS(object) ( \
|
||||
G_TYPE_INSTANCE_GET_CLASS((object), \
|
||||
SUGAR_TYPE_BROWSER_CHANDLER, \
|
||||
SugarBrowserChandlerClass))
|
||||
|
||||
struct _SugarBrowserChandler {
|
||||
GObject base_instance;
|
||||
};
|
||||
|
||||
struct _SugarBrowserChandlerClass {
|
||||
GObjectClass base_class;
|
||||
|
||||
guint handle_content_signal_id;
|
||||
|
||||
void (* handle_content) (char *url, char *tmp_file_name);
|
||||
|
||||
};
|
||||
|
||||
GType sugar_browser_chandler_get_type (void);
|
||||
SugarBrowserChandler *sugar_get_browser_chandler ();
|
||||
void sugar_browser_chandler_handle_content (
|
||||
SugarBrowserChandler *browser_chandler,
|
||||
const char *url,
|
||||
const char *suggested_file_name,
|
||||
const char *mime_type,
|
||||
const char *tmp_file_name);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
@ -1,2 +1,3 @@
|
||||
VOID:OBJECT,STRING,LONG,LONG
|
||||
VOID:OBJECT,LONG
|
||||
VOID:STRING,STRING,STRING,STRING
|
||||
|
Loading…
Reference in New Issue