]> Dogcows Code - chaz/openbox/blobdiff - util/bsetroot.cc
make work with new i18n
[chaz/openbox] / util / bsetroot.cc
index 303323dff7e6f35b675808ee0616a49bcffb814a..69dd8c4e7de28ef1eb62de5df1a2631d9f16bbe9 100644 (file)
@@ -44,6 +44,8 @@
 
 #include <algorithm>
 
+I18n i18n("openbox.cat");
+
 bsetroot::bsetroot(int argc, char **argv, char *dpy_name)
   : BaseDisplay(argv[0], dpy_name)
 {
@@ -99,9 +101,8 @@ bsetroot::bsetroot(int argc, char **argv, char *dpy_name)
 
   if ((mod + sol + grd) != True) {
     fprintf(stderr,
-      i18n->getMessage(bsetrootSet, bsetrootMustSpecify,
-                       "%s: error: must specify one of: "
-                       "-solid, -mod, -gradient\n"),
+      i18n(bsetrootSet, bsetrootMustSpecify,
+           "%s: error: must specify one of: -solid, -mod, -gradient\n"),
       getApplicationName());
 
     usage(2);
@@ -136,8 +137,6 @@ void bsetroot::setPixmapProperty(int screen, Pixmap pixmap) {
   int format;
   unsigned long length, after;
   unsigned char *data;
-  int mode = PropModeAppend;
-  int emode = PropModeAppend;
   const ScreenInfo *screen_info = getScreenInfo(screen);
 
   if (rootpmap_id == None) {
@@ -147,29 +146,22 @@ void bsetroot::setPixmapProperty(int screen, Pixmap pixmap) {
 
   XGrabServer(getXDisplay());
 
-  // Clear out the old pixmap?
+  // Clear out the old pixmap
   XGetWindowProperty(getXDisplay(), screen_info->getRootWindow(),
-                     rootpmap_id, 0L, 1L, False, AnyPropertyType,
+                     rootpmap_id, 0L, 1L, False, XA_PIXMAP,
                      &type, &format, &length, &after, &data);
-  if ((type == XA_PIXMAP) && (format == 32) && (length == 1)) {
+  if (type == XA_PIXMAP && format == 32) {
     XKillClient(getXDisplay(), *((Pixmap *) data));
     XSync(getXDisplay(), False);
-    mode = PropModeReplace;
+    XFree(data);
   }
 
-  // Clear out the old esetroot pixmap?
-  XGetWindowProperty(getXDisplay(), screen_info->getRootWindow(),
-                     esetroot_id, 0L, 1L, False, AnyPropertyType,
-                     &type, &format, &length, &after, &data);
-  if ((type == XA_PIXMAP) && (format == 32) && (length == 1))
-    emode = PropModeReplace;
-
   if (pixmap) {
     XChangeProperty(getXDisplay(), screen_info->getRootWindow(),
-        rootpmap_id, XA_PIXMAP, 32, mode,
+        rootpmap_id, XA_PIXMAP, 32, PropModeReplace,
         (unsigned char *) &pixmap, 1);
     XChangeProperty(getXDisplay(), screen_info->getRootWindow(),
-        esetroot_id, XA_PIXMAP, 32, emode,
+        esetroot_id, XA_PIXMAP, 32, PropModeReplace,
         (unsigned char *) &pixmap, 1);
   } else {
     XDeleteProperty(getXDisplay(), screen_info->getRootWindow(),
@@ -337,7 +329,7 @@ void bsetroot::gradient(void) {
 
 void bsetroot::usage(int exit_code) {
     fprintf(stderr,
-      i18n->getMessage(bsetrootSet, bsetrootUsage,
+      i18n(bsetrootSet, bsetrootUsage,
      "%s 2.0\n\n"
      "Copyright (c) 1997-2000, 2002 Bradley T Hughes\n"
      "Copyright (c) 2001-2002 Sean 'Shaleh' Perry\n\n"
@@ -358,15 +350,13 @@ void bsetroot::usage(int exit_code) {
 int main(int argc, char **argv) {
   char *display_name = (char *) 0;
 
-  NLSInit("openbox.cat");
-  
   for (int i = 1; i < argc; i++) {
     if (! strcmp(argv[i], "-display")) {
       // check for -display option
 
       if ((++i) >= argc) {
-        fprintf(stderr, i18n->getMessage(mainSet, mainDISPLAYRequiresArg,
-                 "error: '-display' requires an argument\n"));
+        fprintf(stderr, i18n(mainSet, mainDISPLAYRequiresArg,
+                             "error: '-display' requires an argument\n"));
 
         ::exit(1);
       }
This page took 0.025268 seconds and 4 git commands to generate.