BrowserCore: GdaBrowser hacking manual

## BrowserCore BrowserCore — Singleton holding the global browser information |

## Stability Level

Stable, unless otherwise indicated

## Functions

GSList * | (*BrowserCoreInitFactories) ()
gboolean | browser_core_exists ()
BrowserCore * | browser_core_get ()
void | browser_core_take_window ()
GSList * | browser_core_get_windows ()
void | browser_core_close_window ()
void | browser_core_take_connection ()
GSList * | browser_core_get_connections ()
void | browser_core_close_connection ()
void | browser_core_quit ()
BrowserPerspectiveFactory * | browser_core_get_default_factory ()
void | browser_core_set_default_factory ()
const GSList * | browser_core_get_factories ()
BrowserPerspectiveFactory * | browser_core_get_factory ()

## Signals

void | connection-added | Run First
void | connection-removed | Run First

## Types and Values

| BrowserCorePrivate
| BrowserCore
| BrowserPerspectiveFactory

## Object Hierarchy

        GObject
        ╰── BrowserCore

## Description

A single instance of a BrowserCore is created when the browser is started, accessible using `browser_core_get()`.

## Functions

### BrowserCoreInitFactories ()

    GSList *
    (*BrowserCoreInitFactories) (void);

### browser_core_exists ()

    gboolean
    browser_core_exists (void);

Tells if a BrowserCore has already been created

#### Returns

`TRUE` if the BrowserCore singleton has already been created

### browser_core_get ()

    BrowserCore *
    browser_core_get (void);

Returns a BrowserCore object which holds the browser's configuration. This is a singleton factory.

#### Returns

the BrowserCore object

### browser_core_take_window ()

    void
    browser_core_take_window (BrowserWindow *bwin);

Makes sure `bwin` is handled by the BrowserCore object, reference to `bwin` is stolen here. This method should be called after a BrowserWindow has been created to have it managed properly.

#### Parameters

bwin | a BrowserWindow |

### browser_core_get_windows ()

    GSList *
    browser_core_get_windows (void);

Get a list of BrowserWindow mananged by the browser (windows must have been declared using `browser_core_take_window()`).

#### Returns

a new list, free it with `g_slist_free()`

### browser_core_close_window ()

    void
    browser_core_close_window (BrowserWindow *bwin);

Requests that `bwin` be closed.

#### Parameters

bwin | a BrowserWindow |

### browser_core_take_connection ()

    void
    browser_core_take_connection (BrowserConnection *bcnc);

Makes sure `bcnc` is handled by `dbata` , reference to `bcnc` is stolen here

#### Parameters

bcnc | a BrowserConnection |

### browser_core_get_connections ()

    GSList *
    browser_core_get_connections (void);

Get a list of BrowserWindow

#### Returns

a new list, free it with `g_slist_free()`

### browser_core_close_connection ()

    void
    browser_core_close_connection (BrowserConnection *bcnc);

Requests that `bcnc` be closed.

#### Parameters

bcnc | a BrowserConnection |

### browser_core_quit ()

    void
    browser_core_quit (void);

Quits the browser after having made some clean-ups

### browser_core_get_default_factory ()

    BrowserPerspectiveFactory *
    browser_core_get_default_factory (void);

Get the default BrowserPerspectiveFactory used when making new BrowserWindow if none is provided when calling `browser_window_new()`.

#### Returns

the default BrowserPerspectiveFactory

### browser_core_set_default_factory ()

    void
    browser_core_set_default_factory (const gchar *factory);

Sets the default BrowserPerspectiveFactory used when making new BrowserWindow if none is provided when calling `browser_window_new()`.

#### Parameters

factory | the name of a BrowserPerspectiveFactory |

### browser_core_get_factories ()

    const GSList *
    browser_core_get_factories (void);

Get a list of all the known Perspective factories

#### Returns

a constant list which must not be altered

### browser_core_get_factory ()

    BrowserPerspectiveFactory *
    browser_core_get_factory (const gchar *factory);

Get a pointer to a BrowserPerspectiveFactory, from its name

#### Parameters

factory | the name of the requested factory |

#### Returns

a pointer to the BrowserPerspectiveFactory, or `NULL` if not found

## Types and Values

### BrowserCorePrivate

    typedef struct _BrowserCorePrivate BrowserCorePrivate;

### BrowserCore

    typedef struct _BrowserCore BrowserCore;

### BrowserPerspectiveFactory

    typedef struct {
    	const gchar          *perspective_name;
    	const gchar          *menu_shortcut;
    	BrowserPerspective *(*perspective_create) (BrowserWindow *);
    } BrowserPerspectiveFactory;

## Signal Details

### The `“connection-added”` signal

    void
    user_function (BrowserCore       *browsercore,
                   BrowserConnection *arg1,
                   gpointer           user_data)

Flags: Run First

### The `“connection-removed”` signal

    void
    user_function (BrowserCore       *browsercore,
                   BrowserConnection *arg1,
                   gpointer           user_data)

Flags: Run First