4 * ROX-Filer, filer for the ROX desktop project
5 * Copyright (C) 2000, Thomas Leonard, <tal197@ecs.soton.ac.uk>.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA 02111-1307 USA
35 #include "gui_support.h"
38 /****************************************************************
39 * EXTERNAL INTERFACE *
40 ****************************************************************/
43 /* Set things up for internationalisation */
47 setlocale(LC_ALL
, "");
48 bindtextdomain("ROX-Filer", make_path(getenv("APP_DIR"), "po")->str
);
49 textdomain("ROX-Filer");
54 /****************************************************************
55 * INTERNAL FUNCTIONS *
56 ****************************************************************/
59 /* These two stolen from dia :-).
60 * Slight modification though: '/%s/' means 'same as above' so that
61 * if a translation is missing it doesn't muck up the whole menu structure!
63 GtkItemFactoryEntry
*translate_entries(GtkItemFactoryEntry
*entries
, gint n
)
65 guchar
*first
= NULL
, *second
= NULL
; /* Previous menu, submenu */
67 GtkItemFactoryEntry
*ret
;
69 ret
= g_malloc(sizeof(GtkItemFactoryEntry
) * n
);
70 for (i
= 0; i
< n
; i
++)
72 guchar
*from
= entries
[i
].path
;
73 guchar
*trans
, *slash
;
85 from
= _(from
+ indent
);
90 trans
= g_strdup_printf("/%s", from
);
92 trans
= g_strdup_printf("/%s/%s", first
, from
);
94 trans
= g_strdup_printf("/%s/%s/%s",
104 slash
= strchr(trans
, '/');
107 first
= g_strndup(trans
, slash
- trans
);
110 slash
= strchr(trans
, '/');
112 second
= g_strndup(trans
, slash
- trans
);
114 second
= g_strdup(trans
);
117 first
= g_strdup(trans
);
119 /* accelerator and item_type are not duped, only referenced */
120 ret
[i
].accelerator
= entries
[i
].accelerator
;
121 ret
[i
].callback
= entries
[i
].callback
;
122 ret
[i
].callback_action
= entries
[i
].callback_action
;
123 ret
[i
].item_type
= entries
[i
].item_type
;
132 void free_translated_entries(GtkItemFactoryEntry
*entries
, gint n
)
137 g_free(entries
[i
].path
);