Some style fixes

This commit is contained in:
Marco Pesenti Gritti 2006-10-26 16:43:22 +02:00
parent 1cc46c315d
commit dbd6fcaf3e
2 changed files with 35 additions and 46 deletions

View File

@ -4,6 +4,12 @@
#include "sugar-marshal.h" #include "sugar-marshal.h"
#include "sugar-browser-chandler.h" #include "sugar-browser-chandler.h"
enum {
HANDLE_CONTENT,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE(SugarBrowserChandler, sugar_browser_chandler, G_TYPE_OBJECT) G_DEFINE_TYPE(SugarBrowserChandler, sugar_browser_chandler, G_TYPE_OBJECT)
SugarBrowserChandler *browserChandler = NULL; SugarBrowserChandler *browserChandler = NULL;
@ -16,27 +22,27 @@ sugar_browser_chandler_init(SugarBrowserChandler *browserChandler)
static void static void
sugar_browser_chandler_class_init(SugarBrowserChandlerClass *browser_chandler_class) sugar_browser_chandler_class_init(SugarBrowserChandlerClass *browser_chandler_class)
{ {
browser_chandler_class->handle_content_signal_id = signals[HANDLE_CONTENT] =
g_signal_new ("handle-content", g_signal_new ("handle-content",
G_OBJECT_CLASS_TYPE (browser_chandler_class), G_OBJECT_CLASS_TYPE (browser_chandler_class),
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (SugarBrowserChandlerClass, handle_content), G_STRUCT_OFFSET (SugarBrowserChandlerClass, handle_content),
NULL, NULL, NULL, NULL,
sugar_marshal_VOID__STRING_STRING_STRING_STRING, sugar_marshal_VOID__STRING_STRING_STRING_STRING,
G_TYPE_NONE, 4, G_TYPE_NONE, 4,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING); G_TYPE_STRING);
} }
SugarBrowserChandler * SugarBrowserChandler *
sugar_get_browser_chandler() sugar_get_browser_chandler()
{ {
if(browserChandler == NULL) if(browserChandler == NULL)
browserChandler = g_object_new(SUGAR_TYPE_BROWSER_CHANDLER, NULL); browserChandler = g_object_new(SUGAR_TYPE_BROWSER_CHANDLER, NULL);
return browserChandler; return browserChandler;
} }
void void
@ -47,8 +53,7 @@ sugar_browser_chandler_handle_content (SugarBrowserChandler *browser_chandler,
const char *tmp_file_name) const char *tmp_file_name)
{ {
g_signal_emit(browser_chandler, g_signal_emit(browser_chandler,
SUGAR_BROWSER_CHANDLER_GET_CLASS( signals[HANDLE_CONTENT],
browser_chandler)->handle_content_signal_id,
0 /* details */, 0 /* details */,
url, url,
suggested_file_name, suggested_file_name,

View File

@ -9,25 +9,12 @@ G_BEGIN_DECLS
typedef struct _SugarBrowserChandler SugarBrowserChandler; typedef struct _SugarBrowserChandler SugarBrowserChandler;
typedef struct _SugarBrowserChandlerClass SugarBrowserChandlerClass; typedef struct _SugarBrowserChandlerClass SugarBrowserChandlerClass;
#define SUGAR_TYPE_BROWSER_CHANDLER ( \ #define SUGAR_TYPE_BROWSER_CHANDLER (sugar_browser_chandler_get_type())
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(object) ( \ #define SUGAR_BROWSER_CHANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SUGAR_TYPE_BROWSER_CHANDLER, SugarBrowserChandlerClass))
G_TYPE_CHECK_INSTANCE_CAST((object), \ #define SUGAR_IS_BROWSER_CHANDLER(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), SUGAR_TYPE_BROWSER_CHANDLER))
SUGAR_TYPE_BROWSER_CHANDLER, SugarBrowserChandler)) #define SUGAR_IS_BROWSER_CHANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SUGAR_TYPE_BROWSER_CHANDLER))
#define SUGAR_BROWSER_CHANDLER_CLASS(klass) ( \ #define SUGAR_BROWSER_CHANDLER_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), SUGAR_TYPE_BROWSER_CHANDLER, SugarBrowserChandlerClass))
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 { struct _SugarBrowserChandler {
GObject base_instance; GObject base_instance;
@ -36,20 +23,17 @@ struct _SugarBrowserChandler {
struct _SugarBrowserChandlerClass { struct _SugarBrowserChandlerClass {
GObjectClass base_class; GObjectClass base_class;
guint handle_content_signal_id;
void (* handle_content) (char *url, char *tmp_file_name); void (* handle_content) (char *url, char *tmp_file_name);
}; };
GType sugar_browser_chandler_get_type (void); GType sugar_browser_chandler_get_type (void);
SugarBrowserChandler *sugar_get_browser_chandler (); SugarBrowserChandler *sugar_get_browser_chandler (void);
void sugar_browser_chandler_handle_content ( void sugar_browser_chandler_handle_content (SugarBrowserChandler *chandler,
SugarBrowserChandler *browser_chandler, const char *url,
const char *url, const char *suggested_file_name,
const char *suggested_file_name, const char *mime_type,
const char *mime_type, const char *tmp_file_name);
const char *tmp_file_name);
G_END_DECLS G_END_DECLS