comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/program/Program.d @ 86:12b890a6392a

Work on databinding
author Frank Benoit <benoit@tionex.de>
date Sat, 18 Apr 2009 13:58:35 +0200
parents ea8b884d85f6
children b397a43d66d1
comparison
equal deleted inserted replaced
85:6be48cf9f95c 86:12b890a6392a
229 } 229 }
230 230
231 /* Determine the desktop for the given display. */ 231 /* Determine the desktop for the given display. */
232 static int getDesktop(Display display) { 232 static int getDesktop(Display display) {
233 if (display is null) return DESKTOP_UNKNOWN; 233 if (display is null) return DESKTOP_UNKNOWN;
234 ValueWrapperInt desktopValue = cast(ValueWrapperInt)display.getData(DESKTOP_DATA); 234 Integer desktopValue = cast(Integer)display.getData(DESKTOP_DATA);
235 if (desktopValue !is null) return desktopValue.value; 235 if (desktopValue !is null) return desktopValue.value;
236 int desktop = DESKTOP_UNKNOWN; 236 int desktop = DESKTOP_UNKNOWN;
237 237
238 /* Get the list of properties on the root window. */ 238 /* Get the list of properties on the root window. */
239 void* xDisplay = OS.GDK_DISPLAY(); 239 void* xDisplay = OS.GDK_DISPLAY();
261 String gnomeName = "_NET_SUPPORTING_WM_CHECK"; 261 String gnomeName = "_NET_SUPPORTING_WM_CHECK";
262 int /*long*/ gnome = OS.XInternAtom(xDisplay, gnomeName.ptr, true); 262 int /*long*/ gnome = OS.XInternAtom(xDisplay, gnomeName.ptr, true);
263 if (gnome !is OS.None && (OS.GTK_VERSION >= OS.buildVERSION (2, 2, 0)) && gnome_init()) { 263 if (gnome !is OS.None && (OS.GTK_VERSION >= OS.buildVERSION (2, 2, 0)) && gnome_init()) {
264 desktop = DESKTOP_GNOME; 264 desktop = DESKTOP_GNOME;
265 int icon_theme = cast(int)GNOME.gnome_icon_theme_new(); 265 int icon_theme = cast(int)GNOME.gnome_icon_theme_new();
266 display.setData(ICON_THEME_DATA, new ValueWrapperInt(icon_theme)); 266 display.setData(ICON_THEME_DATA, new Integer(icon_theme));
267 display.addListener(SWT.Dispose, new class(display) Listener { 267 display.addListener(SWT.Dispose, new class(display) Listener {
268 Display display; 268 Display display;
269 this( Display display ){ this.display = display; } 269 this( Display display ){ this.display = display; }
270 public void handleEvent(Event event) { 270 public void handleEvent(Event event) {
271 ValueWrapperInt gnomeIconTheme = cast(ValueWrapperInt)display.getData(ICON_THEME_DATA); 271 Integer gnomeIconTheme = cast(Integer)display.getData(ICON_THEME_DATA);
272 if (gnomeIconTheme is null) return; 272 if (gnomeIconTheme is null) return;
273 display.setData(ICON_THEME_DATA, null); 273 display.setData(ICON_THEME_DATA, null);
274 /* 274 /*
275 * Note. gnome_icon_theme_new uses g_object_new to allocate the 275 * Note. gnome_icon_theme_new uses g_object_new to allocate the
276 * data it returns. Use g_object_unref to free the pointer it returns. 276 * data it returns. Use g_object_unref to free the pointer it returns.
304 if (property[index] is cde && cde_init(display)) desktop = DESKTOP_CDE; 304 if (property[index] is cde && cde_init(display)) desktop = DESKTOP_CDE;
305 } 305 }
306 } 306 }
307 +/ 307 +/
308 308
309 display.setData(DESKTOP_DATA, new ValueWrapperInt(desktop)); 309 display.setData(DESKTOP_DATA, new Integer(desktop));
310 return desktop; 310 return desktop;
311 } 311 }
312 312
313 // PORTING CDE not supported 313 // PORTING CDE not supported
314 /+ 314 /+
686 String buffer = fromStringz(application.command)._idup(); 686 String buffer = fromStringz(application.command)._idup();
687 program.command = buffer; 687 program.command = buffer;
688 program.gnomeExpectUri = application.expects_uris is GNOME.GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS; 688 program.gnomeExpectUri = application.expects_uris is GNOME.GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS;
689 689
690 buffer = (fromStringz( application.id) ~ '\0')._idup(); 690 buffer = (fromStringz( application.id) ~ '\0')._idup();
691 ValueWrapperInt gnomeIconTheme = cast(ValueWrapperInt)display.getData(ICON_THEME_DATA); 691 Integer gnomeIconTheme = cast(Integer)display.getData(ICON_THEME_DATA);
692 char* icon_name = GNOME.gnome_icon_lookup( cast(GtkIconTheme*) gnomeIconTheme.value, null, null, cast(char*)buffer.ptr, null, mimeTypeBuffer, 692 char* icon_name = GNOME.gnome_icon_lookup( cast(GtkIconTheme*) gnomeIconTheme.value, null, null, cast(char*)buffer.ptr, null, mimeTypeBuffer,
693 GNOME.GNOME_ICON_LOOKUP_FLAGS_NONE, null); 693 GNOME.GNOME_ICON_LOOKUP_FLAGS_NONE, null);
694 char* path = null; 694 char* path = null;
695 if (icon_name !is null) path = GNOME.gnome_icon_theme_lookup_icon(cast(GtkIconTheme*)gnomeIconTheme.value, icon_name, PREFERRED_ICON_SIZE, null, null); 695 if (icon_name !is null) path = GNOME.gnome_icon_theme_lookup_icon(cast(GtkIconTheme*)gnomeIconTheme.value, icon_name, PREFERRED_ICON_SIZE, null, null);
696 if (path !is null) { 696 if (path !is null) {