obconf is moving into its own tree
This commit is contained in:
parent
84a60ebbfb
commit
237cc7278b
9 changed files with 0 additions and 898 deletions
|
@ -1,6 +0,0 @@
|
|||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
obconf
|
||||
.dirstamp
|
|
@ -1,4 +0,0 @@
|
|||
all clean install:
|
||||
$(MAKE) -C ../.. -$(MAKEFLAGS) $@
|
||||
|
||||
.PHONY: all clean install
|
|
@ -1,18 +0,0 @@
|
|||
#include "obconf.h"
|
||||
|
||||
void on_about_activate(GtkMenuItem *item, gpointer d)
|
||||
{
|
||||
gtk_widget_show(GTK_WIDGET(obconf_about));
|
||||
}
|
||||
|
||||
gboolean on_aboutdialog_delete_event(GtkWidget *w, GdkEvent *e, gpointer d)
|
||||
{
|
||||
gtk_widget_hide(GTK_WIDGET(obconf_about));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void on_about_closebutton_clicked(GtkButton *but, gpointer d)
|
||||
{
|
||||
gtk_widget_hide(GTK_WIDGET(obconf_about));
|
||||
}
|
||||
|
|
@ -1,250 +0,0 @@
|
|||
/*#include "obconf.h"
|
||||
#include "plugins.h"*/
|
||||
#include "parser/parse.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#define OB_ICON "openbox-icon"
|
||||
|
||||
static GtkWidget *mainwin;
|
||||
static GtkWidget *mainlist;
|
||||
static GtkListStore *mainstore;
|
||||
static GtkWidget *mainworkarea;
|
||||
static GdkPixbuf *ob_icon;
|
||||
|
||||
enum {
|
||||
NAME_COLUMN,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
gboolean on_mainwindow_delete_event(GtkWidget *w, GdkEvent *e, gpointer d);
|
||||
void on_quit_activate(GtkMenuItem *item, gpointer d);
|
||||
void on_applybutton_clicked(GtkButton *but, gpointer d);
|
||||
void on_revertbutton_clicked(GtkButton *but, gpointer d);
|
||||
void on_selection_changed(GtkTreeSelection *selection, gpointer data);
|
||||
|
||||
static void obconf_error(GError *e)
|
||||
{
|
||||
GtkWidget *d;
|
||||
|
||||
d = gtk_message_dialog_new(mainwin ? GTK_WINDOW(mainwin) : NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"%s", e->message);
|
||||
g_signal_connect_swapped(GTK_OBJECT(d), "response",
|
||||
G_CALLBACK(gtk_widget_destroy),
|
||||
GTK_OBJECT(d));
|
||||
gtk_widget_show(d);
|
||||
}
|
||||
|
||||
static void load_stock ()
|
||||
{
|
||||
GtkIconFactory *factory;
|
||||
GError *e = NULL;
|
||||
|
||||
gtk_icon_factory_add_default (factory = gtk_icon_factory_new ());
|
||||
|
||||
ob_icon = gdk_pixbuf_new_from_file (PIXMAPDIR G_DIR_SEPARATOR_S
|
||||
"openbox.png", &e);
|
||||
if (!ob_icon) {
|
||||
gchar *msg = g_strdup_printf
|
||||
(_("Failed to load the Openbox icon, Openbox is probably not "
|
||||
"installed correctly. The error given was '%s'."),
|
||||
e->message);
|
||||
g_free (e->message);
|
||||
e->message = msg;
|
||||
obconf_error (e);
|
||||
} else {
|
||||
GtkIconSet *set;
|
||||
|
||||
set = gtk_icon_set_new_from_pixbuf (ob_icon);
|
||||
gtk_icon_factory_add (factory, OB_ICON, set);
|
||||
gtk_icon_set_unref (set);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget* build_menu(GtkAccelGroup *accel)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *submenu;
|
||||
GtkWidget *item;
|
||||
|
||||
menu = gtk_menu_bar_new();
|
||||
|
||||
/* File menu */
|
||||
|
||||
submenu = gtk_menu_new();
|
||||
gtk_menu_set_accel_group(GTK_MENU(submenu), accel);
|
||||
|
||||
item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accel);
|
||||
g_signal_connect(item, "activate", G_CALLBACK(on_quit_activate), NULL);
|
||||
gtk_menu_append(GTK_MENU(submenu), item);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic("_File");
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
|
||||
gtk_menu_bar_append(GTK_MENU_BAR(menu), item);
|
||||
|
||||
/* About menu */
|
||||
|
||||
submenu = gtk_menu_new();
|
||||
gtk_menu_set_accel_group(GTK_MENU(submenu), accel);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic("_About");
|
||||
gtk_menu_append(GTK_MENU(submenu), item);
|
||||
|
||||
item = gtk_menu_item_new_with_mnemonic("_Help");
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu);
|
||||
gtk_menu_bar_append(GTK_MENU_BAR(menu), item);
|
||||
|
||||
gtk_widget_show_all(menu);
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
GtkWidget* build_list(GtkListStore **model)
|
||||
{
|
||||
GtkWidget *list;
|
||||
GtkListStore *store;
|
||||
GtkCellRenderer *ren;
|
||||
GtkTreeViewColumn *col;
|
||||
GtkTreeSelection *sel;
|
||||
|
||||
store = gtk_list_store_new(N_COLUMNS,
|
||||
G_TYPE_STRING);
|
||||
|
||||
list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
|
||||
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(list), FALSE);
|
||||
|
||||
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(list));
|
||||
gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE);
|
||||
g_signal_connect(sel, "changed", G_CALLBACK(on_selection_changed), NULL);
|
||||
|
||||
ren = gtk_cell_renderer_text_new();
|
||||
col = gtk_tree_view_column_new_with_attributes("Name",
|
||||
ren,
|
||||
"text",
|
||||
NAME_COLUMN,
|
||||
NULL);
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(list), col);
|
||||
|
||||
*model = store;
|
||||
return list;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hpane;
|
||||
GtkAccelGroup *accel;
|
||||
GtkWidget *sep;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *but;
|
||||
GtkWidget *bar;
|
||||
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(mainwin), "Obconf");
|
||||
gtk_window_set_wmclass(GTK_WINDOW(mainwin), "obconf", "Obconf");
|
||||
gtk_window_set_role(GTK_WINDOW(mainwin), "main window");
|
||||
|
||||
g_signal_connect(mainwin, "delete-event",
|
||||
G_CALLBACK(on_mainwindow_delete_event), NULL);
|
||||
|
||||
accel = gtk_accel_group_new();
|
||||
gtk_window_add_accel_group(GTK_WINDOW(mainwin), accel);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(mainwin), vbox);
|
||||
|
||||
/* Menu */
|
||||
|
||||
menu = build_menu(accel);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menu, FALSE, FALSE, 0);
|
||||
|
||||
hpane = gtk_hpaned_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox), hpane, TRUE, TRUE, 0);
|
||||
|
||||
/* List */
|
||||
|
||||
mainlist = build_list(&mainstore);
|
||||
gtk_container_add(GTK_CONTAINER(hpane), mainlist);
|
||||
|
||||
/* Main work area */
|
||||
|
||||
mainworkarea = gtk_layout_new(NULL, NULL);
|
||||
gtk_container_add(GTK_CONTAINER(hpane), mainworkarea);
|
||||
|
||||
/* Separator */
|
||||
|
||||
sep = gtk_hseparator_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0);
|
||||
|
||||
/* Button box */
|
||||
|
||||
bbox = gtk_hbutton_box_new();
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 6);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
|
||||
|
||||
/* Revert Button */
|
||||
|
||||
but = gtk_button_new_with_mnemonic("_Revert");
|
||||
gtk_box_pack_start(GTK_BOX(bbox), but, FALSE, FALSE, 0);
|
||||
|
||||
/* Apply Button */
|
||||
|
||||
but = gtk_button_new_with_mnemonic("_Apply");
|
||||
gtk_box_pack_start(GTK_BOX(bbox), but, FALSE, FALSE, 0);
|
||||
|
||||
/* Status bar */
|
||||
|
||||
bar = gtk_statusbar_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox), bar, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show_all(mainwin);
|
||||
|
||||
load_stock();
|
||||
if (ob_icon) gtk_window_set_icon(GTK_WINDOW(mainwin), ob_icon);
|
||||
|
||||
gtk_main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
gboolean on_mainwindow_delete_event(GtkWidget *w, GdkEvent *e, gpointer d)
|
||||
{
|
||||
gtk_main_quit();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void on_quit_activate(GtkMenuItem *item, gpointer d)
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void on_applybutton_clicked(GtkButton *but, gpointer d)
|
||||
{
|
||||
g_message("apply");
|
||||
}
|
||||
|
||||
void on_revertbutton_clicked(GtkButton *but, gpointer d)
|
||||
{
|
||||
g_message("revert");
|
||||
}
|
||||
|
||||
void on_selection_changed(GtkTreeSelection *sel, gpointer data)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
|
||||
if (gtk_tree_selection_get_selected(sel, &model, &iter)) {
|
||||
g_message("activated");
|
||||
} else {
|
||||
g_message("none activated");
|
||||
}
|
||||
}
|
|
@ -1,427 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="mainwindow">
|
||||
<property name="title" translatable="yes">ObConf</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<signal name="delete_event" handler="on_mainwindow_delete_event" last_modification_time="Sat, 24 May 2003 17:17:43 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuBar" id="menubar1">
|
||||
<property name="visible">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menuitem1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_File</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menuitem1_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkImageMenuItem" id="quit">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">gtk-quit</property>
|
||||
<property name="use_stock">True</property>
|
||||
<signal name="activate" handler="on_quit_activate" last_modification_time="Sat, 24 May 2003 17:00:32 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="menuitem4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Help</property>
|
||||
<property name="use_underline">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenu" id="menuitem4_menu">
|
||||
|
||||
<child>
|
||||
<widget class="GtkMenuItem" id="about">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_About</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_about_activate" last_modification_time="Sat, 24 May 2003 17:00:32 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHPaned" id="hpaned1">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="position">121</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Sections</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="sectiontree">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<signal name="row_activated" handler="on_sectiontree_row_activated" last_modification_time="Sat, 24 May 2003 17:00:00 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="shrink">True</property>
|
||||
<property name="resize">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Options</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="optionsnotebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="show_tabs">False</property>
|
||||
<property name="show_border">False</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">False</property>
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="shrink">True</property>
|
||||
<property name="resize">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_START</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="helpbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<signal name="clicked" handler="on_helpbutton_clicked" last_modification_time="Sat, 24 May 2003 16:59:34 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="revertbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<signal name="clicked" handler="on_revertbutton_clicked" last_modification_time="Sat, 24 May 2003 16:59:29 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Revert</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="applybutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-apply</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<signal name="clicked" handler="on_applybutton_clicked" last_modification_time="Sat, 24 May 2003 16:59:16 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkDialog" id="aboutdialog">
|
||||
<property name="title" translatable="yes">About ObConf</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="has_separator">True</property>
|
||||
<signal name="delete_event" handler="on_aboutdialog_delete_event" last_modification_time="Sat, 24 May 2003 17:29:16 GMT"/>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="about_closebutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="response_id">-7</property>
|
||||
<signal name="clicked" handler="on_about_closebutton_clicked" last_modification_time="Sat, 24 May 2003 17:24:49 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">ObConf
|
||||
|
||||
ObConf is a configuration tool for the
|
||||
Openbox Window Manager.
|
||||
|
||||
|
||||
|
||||
|
||||
ObConf is (c) 2003 Ben Jansens</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
|
||||
|
||||
<glade-project>
|
||||
<name>ObConf</name>
|
||||
<program_name>obconf</program_name>
|
||||
<gnome_support>FALSE</gnome_support>
|
||||
</glade-project>
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef __obconf_h
|
||||
#define __obconf_h
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
extern GtkWindow *obconf_win;
|
||||
extern GtkWindow *obconf_about;
|
||||
extern GtkTreeView *obconf_sections;
|
||||
extern GtkListStore *obconf_sections_store;
|
||||
extern GtkNotebook *obconf_options;
|
||||
|
||||
#endif
|
|
@ -1,157 +0,0 @@
|
|||
#include "obconf.h"
|
||||
#include "plugins/obconf_interface.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <gmodule.h>
|
||||
|
||||
typedef struct ConfigPlugin {
|
||||
GModule *module;
|
||||
char *fname;
|
||||
char *name;
|
||||
char *plugin_name;
|
||||
|
||||
PluginStartupFunc start;
|
||||
PluginShutdownFunc stop;
|
||||
PluginInterfaceVersionFunc interface;
|
||||
PluginNameFunc getname;
|
||||
PluginPluginNameFunc getpname;
|
||||
PluginIconFunc icon;
|
||||
PluginToplevelWidgetFunc toplevel;
|
||||
PluginEditedFunc edited;
|
||||
PluginLoadFunc load;
|
||||
PluginSaveFunc save;
|
||||
} ConfigPlugin;
|
||||
|
||||
GSList *plugins_list = NULL;
|
||||
|
||||
static gpointer load_sym(GModule *module, char *name, char *symbol,
|
||||
gboolean allow_fail)
|
||||
{
|
||||
gpointer var;
|
||||
if (!g_module_symbol(module, symbol, &var)) {
|
||||
if (!allow_fail)
|
||||
g_warning("Failed to load symbol '%s' from plugin '%s'",
|
||||
symbol, name);
|
||||
var = NULL;
|
||||
}
|
||||
return var;
|
||||
}
|
||||
|
||||
static void add_plugin(ConfigPlugin *p)
|
||||
{
|
||||
GtkTreeIter it;
|
||||
|
||||
gtk_list_store_append(obconf_sections_store, &it);
|
||||
gtk_list_store_set(obconf_sections_store, &it, 0, p->name, -1);
|
||||
gtk_notebook_append_page(obconf_options, p->toplevel(), NULL);
|
||||
}
|
||||
|
||||
void load_dir(char *path)
|
||||
{
|
||||
char *fpath;
|
||||
DIR *dir;
|
||||
struct dirent *dirp;
|
||||
ConfigPlugin *p;
|
||||
GModule *mod;
|
||||
GSList *it;
|
||||
char *suffix;
|
||||
|
||||
suffix = g_strconcat("-config.", G_MODULE_SUFFIX, NULL);
|
||||
|
||||
if (!(dir = opendir(path)))
|
||||
return;
|
||||
while ((dirp = readdir(dir))) {
|
||||
if (g_strrstr(dirp->d_name, suffix)) {
|
||||
/* look for duplicates */
|
||||
for (it = plugins_list; it; it = it->next)
|
||||
if (!strcmp(((ConfigPlugin*)it->data)->fname, dirp->d_name))
|
||||
break;
|
||||
if (!it) {
|
||||
fpath = g_build_filename(path, dirp->d_name, NULL);
|
||||
|
||||
if ((mod = g_module_open(fpath, 0))) {
|
||||
p = g_new(ConfigPlugin, 1);
|
||||
p->module = mod;
|
||||
p->fname = g_strdup(dirp->d_name);
|
||||
|
||||
p->interface = (PluginInterfaceVersionFunc)
|
||||
load_sym(p->module, p->fname,
|
||||
"plugin_interface_version",
|
||||
FALSE);
|
||||
p->start = (PluginStartupFunc)
|
||||
load_sym(p->module, p->fname, "plugin_startup", FALSE);
|
||||
p->stop = (PluginShutdownFunc)
|
||||
load_sym(p->module, p->fname, "plugin_shutdown",FALSE);
|
||||
p->getname = (PluginNameFunc)
|
||||
load_sym(p->module, p->fname, "plugin_name", FALSE);
|
||||
p->getpname = (PluginNameFunc)
|
||||
load_sym(p->module, p->fname, "plugin_plugin_name",
|
||||
FALSE);
|
||||
p->icon = (PluginIconFunc)
|
||||
load_sym(p->module, p->fname, "plugin_icon", FALSE);
|
||||
p->toplevel = (PluginToplevelWidgetFunc)
|
||||
load_sym(p->module, p->fname, "plugin_toplevel_widget",
|
||||
FALSE);
|
||||
p->edited = (PluginEditedFunc)
|
||||
load_sym(p->module, p->fname, "plugin_edited", FALSE);
|
||||
p->load = (PluginLoadFunc)
|
||||
load_sym(p->module, p->fname, "plugin_load", FALSE);
|
||||
p->save = (PluginSaveFunc)
|
||||
load_sym(p->module, p->fname, "plugin_save", FALSE);
|
||||
|
||||
if (!(p->start &&
|
||||
p->stop &&
|
||||
p->interface &&
|
||||
p->name &&
|
||||
p->icon &&
|
||||
p->toplevel &&
|
||||
p->edited &&
|
||||
p->load &&
|
||||
p->save)) {
|
||||
g_module_close(p->module);
|
||||
g_free(p->fname);
|
||||
g_free(p);
|
||||
} else {
|
||||
p->start();
|
||||
p->name = p->getname();
|
||||
p->plugin_name = p->getpname();
|
||||
plugins_list = g_slist_append(plugins_list, p);
|
||||
|
||||
add_plugin(p); /* add to the gui */
|
||||
}
|
||||
}
|
||||
g_free(fpath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_free(suffix);
|
||||
}
|
||||
|
||||
void plugins_load()
|
||||
{
|
||||
char *path;
|
||||
|
||||
path = g_build_filename(g_get_home_dir(), ".openbox", "plugins", NULL);
|
||||
load_dir(path);
|
||||
g_free(path);
|
||||
|
||||
load_dir(PLUGINDIR);
|
||||
}
|
||||
|
||||
gboolean plugins_edited(ConfigPlugin *p)
|
||||
{
|
||||
return p->edited();
|
||||
}
|
||||
|
||||
void plugins_load_settings(ConfigPlugin *p, xmlDocPtr doc, xmlNodePtr root)
|
||||
{
|
||||
p->load(doc, root);
|
||||
}
|
||||
|
||||
void plugins_save_settings(ConfigPlugin *p, xmlDocPtr doc, xmlNodePtr root)
|
||||
{
|
||||
p->save(doc, root);
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#ifndef __plugins_h
|
||||
#define __plugins_h
|
||||
|
||||
#include <libxml/parser.h>
|
||||
|
||||
typedef struct ConfigPlugin ConfigPlugin;
|
||||
|
||||
extern GSList *plugins_list;
|
||||
|
||||
void plugins_load();
|
||||
|
||||
gboolean plugins_edited(ConfigPlugin *p);
|
||||
void plugins_load_settings(ConfigPlugin *p, xmlDocPtr doc, xmlNodePtr root);
|
||||
void plugins_save_settings(ConfigPlugin *p, xmlDocPtr doc, xmlNodePtr root);
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue