restarting work on obconf
This commit is contained in:
parent
c4275beff0
commit
a354b0f5a9
5 changed files with 93 additions and 52 deletions
30
Makefile.am
30
Makefile.am
|
@ -5,6 +5,7 @@ localedir = $(datadir)/locale
|
|||
rcdir = $(datadir)/openbox
|
||||
plugindir = $(libdir)/openbox/plugins
|
||||
desktopfilesdir = $(datadir)/gnome/wm-properties
|
||||
pixmapdir = $(datadir)/pixmaps
|
||||
|
||||
theme = operation
|
||||
|
||||
|
@ -34,8 +35,11 @@ plugin_LTLIBRARIES = \
|
|||
plugins/menu/include_menu.la
|
||||
|
||||
if OBCONF
|
||||
plugin_LTLIBRARIES += \
|
||||
plugins/resistance/resistance-config.la
|
||||
bin_PROGRAMS += \
|
||||
tools/obconf/obconf
|
||||
|
||||
#plugin_LTLIBRARIES += \
|
||||
# plugins/resistance/resistance-config.la
|
||||
endif
|
||||
|
||||
## render ##
|
||||
|
@ -328,6 +332,28 @@ plugins_menu_include_menu_la_SOURCES = \
|
|||
plugins/menu/include_menu.c
|
||||
|
||||
|
||||
## obconf ##
|
||||
|
||||
tools_obconf_obconf_CPPFLAGS = \
|
||||
$(GTK_CFLAGS) \
|
||||
$(GDK_PIXBUF_CFLAGS) \
|
||||
$(XML_CFLAGS) \
|
||||
-DLOCALEDIR=\"$(localedir)\" \
|
||||
-DPLUGINDIR=\"$(plugindir)\" \
|
||||
-DRCDIR=\"$(rcdir)\" \
|
||||
-DPIXMAPDIR=\"$(pixmapdir)\" \
|
||||
-DG_LOG_DOMAIN=\"Obconf\"
|
||||
tools_obconf_obconf_LDADD = \
|
||||
$(GTK_LIBS) \
|
||||
$(GDK_PIXBUF_LIBS) \
|
||||
$(LIBINTL) \
|
||||
render/libobrender.la \
|
||||
parser/libobparser.la
|
||||
tools_obconf_obconf_SOURCES = \
|
||||
gettext.h \
|
||||
tools/obconf/main.c
|
||||
|
||||
|
||||
## themes ##
|
||||
|
||||
dist_theme_DATA = \
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -67,14 +67,14 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0],
|
|||
AC_SUBST(GTK_LIBS)
|
||||
use_gtk="yes"
|
||||
|
||||
PKG_CHECK_MODULES(GLADE, [libglade-2.0],
|
||||
PKG_CHECK_MODULES(GDK_PIXBUF, [gdk-pixbuf-2.0],
|
||||
[
|
||||
AC_SUBST(GLADE_CFLAGS)
|
||||
AC_SUBST(GLADE_LIBS)
|
||||
use_glade="yes"
|
||||
AC_SUBST(GDK_PIXBUF_CFLAGS)
|
||||
AC_SUBST(GDK_PIXBUF_LIBS)
|
||||
use_gdk_pixbuf="yes"
|
||||
],
|
||||
[
|
||||
use_glade="no"
|
||||
use_gdk_pixbuf="no"
|
||||
AC_MSG_WARN([disabling build of the configuration tool])
|
||||
]
|
||||
)
|
||||
|
@ -84,8 +84,8 @@ PKG_CHECK_MODULES(GTK, [gtk+-2.0],
|
|||
AC_MSG_WARN([disabling build of the configuration tool])
|
||||
]
|
||||
)
|
||||
#AM_CONDITIONAL(OBCONF, [test "$use_gtk" = "yes" && test "$use_glade" = "yes"])
|
||||
AM_CONDITIONAL(OBCONF, [false])
|
||||
AM_CONDITIONAL(OBCONF,
|
||||
[test "$use_gtk" = "yes" && test "$use_gdk_pixbuf" = "yes"])
|
||||
|
||||
# Check for session management
|
||||
X11_SM
|
||||
|
|
|
@ -3,3 +3,4 @@
|
|||
Makefile
|
||||
Makefile.in
|
||||
obconf
|
||||
.dirstamp
|
||||
|
|
4
tools/obconf/Makefile
Normal file
4
tools/obconf/Makefile
Normal file
|
@ -0,0 +1,4 @@
|
|||
all clean install:
|
||||
$(MAKE) -C ../.. -$(MAKEFLAGS) $@
|
||||
|
||||
.PHONY: all clean install
|
|
@ -1,59 +1,69 @@
|
|||
#include "kernel/debug.h"
|
||||
#include "obconf.h"
|
||||
#include "plugins.h"
|
||||
#include "parser/parse.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glade/glade.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
/*#include <X11/Xlib.h>
|
||||
Display *ob_display;
|
||||
int ob_screen;
|
||||
Window ob_root;*/
|
||||
#define OB_ICON "openbox-icon"
|
||||
|
||||
GtkWindow *obconf_win;
|
||||
GtkWindow *obconf_about = NULL;
|
||||
static GtkWidget *mainwin;
|
||||
static GdkPixbuf *ob_icon;
|
||||
|
||||
GtkTreeView *obconf_sections;
|
||||
GtkListStore *obconf_sections_store;
|
||||
static GtkCellRenderer *obconf_sections_renderer;
|
||||
static GtkTreeViewColumn *obconf_sections_column;
|
||||
static void obconf_error(GError *e)
|
||||
{
|
||||
GtkWidget *d;
|
||||
|
||||
GtkNotebook *obconf_options;
|
||||
d = gtk_message_dialog_new(mainwin ? GTK_WINDOW(mainwin) : NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"%s", e->message);
|
||||
gtk_dialog_run(GTK_DIALOG(d));
|
||||
gtk_widget_destroy(d);
|
||||
}
|
||||
|
||||
static xmlDocPtr doc;
|
||||
static xmlNodePtr root;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GladeXML *xml;
|
||||
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
xml = glade_xml_new("obconf.glade", NULL, NULL);
|
||||
glade_xml_signal_autoconnect(xml);
|
||||
load_stock();
|
||||
|
||||
obconf_win = GTK_WINDOW(glade_xml_get_widget(xml, "mainwindow"));
|
||||
gtk_window_set_role(obconf_win, "main");
|
||||
obconf_about = GTK_WINDOW(glade_xml_get_widget(xml, "aboutdialog"));
|
||||
gtk_window_set_role(obconf_about, "about");
|
||||
gtk_window_set_transient_for(obconf_about, obconf_win);
|
||||
obconf_sections = GTK_TREE_VIEW(glade_xml_get_widget(xml, "sectiontree"));
|
||||
obconf_options = GTK_NOTEBOOK(glade_xml_get_widget(xml,"optionsnotebook"));
|
||||
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");
|
||||
if (ob_icon) gtk_window_set_icon(GTK_WINDOW(mainwin), ob_icon);
|
||||
|
||||
obconf_sections_store = gtk_list_store_new(1, G_TYPE_STRING);
|
||||
gtk_tree_view_set_model(obconf_sections,
|
||||
GTK_TREE_MODEL(obconf_sections_store));
|
||||
obconf_sections_renderer = gtk_cell_renderer_text_new();
|
||||
obconf_sections_column = gtk_tree_view_column_new_with_attributes
|
||||
("Section", obconf_sections_renderer, "text", 0, NULL);
|
||||
gtk_tree_view_append_column (obconf_sections, obconf_sections_column);
|
||||
|
||||
parse_load_rc(&doc, &root);
|
||||
|
||||
plugins_load();
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(obconf_win));
|
||||
gtk_widget_show_all(mainwin);
|
||||
|
||||
gtk_main();
|
||||
return 0;
|
||||
|
@ -72,21 +82,21 @@ void on_quit_activate(GtkMenuItem *item, gpointer d)
|
|||
|
||||
void on_applybutton_clicked(GtkButton *but, gpointer d)
|
||||
{
|
||||
ob_debug("apply\n");
|
||||
g_message("apply\n");
|
||||
}
|
||||
|
||||
void on_revertbutton_clicked(GtkButton *but, gpointer d)
|
||||
{
|
||||
ob_debug("revert\n");
|
||||
g_message("revert\n");
|
||||
}
|
||||
|
||||
void on_helpbutton_clicked(GtkButton *but, gpointer d)
|
||||
{
|
||||
ob_debug("help\n");
|
||||
g_message("help\n");
|
||||
}
|
||||
|
||||
void on_sectiontree_row_activated(GtkTreeView *tree, GtkTreePath *path,
|
||||
GtkTreeViewColumn *col, gpointer p)
|
||||
{
|
||||
ob_debug("activated\n");
|
||||
g_message("activated\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue