grim/guifications3

closing this since just about everything that can be is converted to cmake, and all newer changes will be maintenance
/*
* Guifications - The end-all, be-all notification framework
* Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gf_gtk_prefs.h"
#include <glib.h>
#include <gtk/gtk.h>
/******************************************************************************
* Structs
*****************************************************************************/
typedef struct {
GtkWidget *window;
GtkWidget *notebook;
} GfGtkPrefsWindow;
/******************************************************************************
* Globals
*****************************************************************************/
static GfGtkPrefsWindow *prefs_window = NULL;
/******************************************************************************
* Callbacks
*****************************************************************************/
static gboolean
gf_gtk_prefs_window_delete_cb(GtkWidget *w, GdkEvent *e, gpointer data) {
gtk_widget_hide(prefs_window->window);
return TRUE;
}
/******************************************************************************
* Helpers
*****************************************************************************/
static void
build_window() {
prefs_window->window =
gtk_dialog_new_with_buttons(_("Preferences"), NULL, 0,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
NULL);
gtk_window_set_role(GTK_WINDOW(prefs_window->window),
"GuificationsGtkPrefs");
g_signal_connect(G_OBJECT(prefs_window->window), "delete-event",
G_CALLBACK(gf_gtk_prefs_window_delete_cb), NULL);
prefs_window->notebook = gtk_notebook_new();
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(prefs_window->window)->vbox),
prefs_window->notebook,
TRUE, TRUE, 0);
gtk_widget_show(prefs_window->notebook);
}
/******************************************************************************
* API
*****************************************************************************/
void
gf_gtk_prefs_init(void) {
if(prefs_window)
return;
prefs_window = g_new0(GfGtkPrefsWindow, 1);
build_window();
}
void
gf_gtk_prefs_uninit(void) {
if(!prefs_window)
return;
if(GTK_IS_WIDGET(prefs_window->window))
gtk_widget_destroy(prefs_window->window);
g_free(prefs_window);
prefs_window = NULL;
}
void
gf_gtk_prefs_show(void) {
if(GTK_IS_WIDGET(prefs_window->window))
gtk_widget_show(prefs_window->window);
}