Begin to test config structure

This commit is contained in:
Moritz Lipp 2010-11-12 13:48:18 +01:00
parent 6046fc71fb
commit 98d42ed3ce
6 changed files with 50 additions and 0 deletions

View File

@ -1 +1,15 @@
/* See LICENSE file for license and copyright information */
#include <callbacks.h>
#include <girara.h>
#include "zathura.h"
gboolean
cb_destroy(GtkWidget* widget, gpointer data)
{
if(Zathura.UI.session)
girara_session_destroy(Zathura.UI.session);
return TRUE;
}

View File

@ -3,4 +3,8 @@
#ifndef CALLBACKS_H
#define CALLBACKS_H
#include <gtk/gtk.h>
gboolean cb_destroy(GtkWidget* widget, gpointer data);
#endif // CALLBACKS_H

View File

@ -1 +1,13 @@
/* See LICENSE file for license and copyright information */
#include "shortcuts.h"
#include "zathura.h"
void
config_load_default()
{
if(!Zathura.UI.session)
return;
girara_shortcut_add(Zathura.UI.session, GDK_CONTROL_MASK, GDK_q, NULL, sc_quit, 0, 0, NULL);
}

View File

@ -3,4 +3,6 @@
#ifndef CONFIG_H
#define CONFIG_H
void config_load_default();
#endif // CONFIG_H

View File

@ -1,5 +1,9 @@
/* See LICENSE file for license and copyright information */
#include <girara.h>
#include <gtk/gtk.h>
#include "callbacks.h"
#include "shortcuts.h"
void
@ -113,7 +117,12 @@ sc_toggle_statusbar(girara_session_t* session, girara_argument_t* argument)
void
sc_quit(girara_session_t* session, girara_argument_t* argument)
{
girara_argument_t arg = { GIRARA_HIDE, NULL };
girara_isc_completion(session, &arg);
cb_destroy(NULL, NULL);
gtk_main_quit();
}
void

View File

@ -1,5 +1,8 @@
/* See LICENSE file for license and copyright information */
#include "callbacks.h"
#include "config.h"
#include "shortcuts.h"
#include "zathura.h"
/* function implementation */
@ -12,6 +15,12 @@ init_zathura()
if(!girara_session_init(Zathura.UI.session))
return false;
/* signals */
g_signal_connect(G_OBJECT(Zathura.UI.session->gtk.window), "destroy", G_CALLBACK(cb_destroy), NULL);
/* configuration */
config_load_default();
return true;
}