clear the fuzzy strings and mark translations without the desktop strings as 3.4.2
[dana/openbox-history.git] / openbox / actions / maximize.c
1 #include "openbox/actions.h"
2 #include "openbox/client.h"
3
4 typedef struct {
5     gboolean toggle;
6     gboolean on;
7 } Options;
8
9 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
10 static void     free_func(gpointer options);
11 static gboolean run_func(ObActionsData *data, gpointer options);
12
13 void action_maximize_startup()
14 {
15     actions_register("Maximize",
16                      setup_func,
17                      free_func,
18                      run_func,
19                      NULL, NULL);
20 }
21
22 static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
23 {
24     xmlNodePtr n;
25     Options *o;
26
27     o = g_new0(Options, 1);
28     o->toggle = TRUE;
29
30     if ((n = parse_find_node("state", node))) {
31         gchar *s = parse_string(doc, n);
32         if (g_ascii_strcasecmp(s, "toggle")) {
33             o->toggle = FALSE;
34             o->on = parse_bool(doc, n);
35         }
36         g_free(s);
37     }
38
39     return o;
40 }
41
42 static void free_func(gpointer options)
43 {
44     Options *o = options;
45
46     g_free(o);
47 }
48
49 /* Always return FALSE because its not interactive */
50 static gboolean run_func(ObActionsData *data, gpointer options)
51 {
52     Options *o = options;
53
54     if (data->client) {
55         actions_client_move(data, TRUE);
56
57         if (o->toggle)
58             client_maximize(data->client,
59                             !data->client->max_horz || !data->client->max_vert,
60                             0);
61         else
62             client_maximize(data->client, o->on, 0);
63
64         actions_client_move(data, FALSE);
65     }
66
67     return FALSE;
68 }