static void chooseIconCallback(WMWidget *self, void *clientData) { char *file; InspectorPanel *panel = (InspectorPanel *) clientData; int result; panel->choosingIcon = 1; WMSetButtonEnabled(panel->browseIconBtn, False); result = wIconChooserDialog(panel->frame->screen_ptr, &file, panel->inspected->wm_instance, panel->inspected->wm_class); panel->choosingIcon = 0; if (!panel->destroyed) { /* kluge */ if (result) { WMSetTextFieldText(panel->fileText, file); showIconFor(WMWidgetScreen(self), panel, NULL, NULL, USE_TEXT_FIELD); } WMSetButtonEnabled(panel->browseIconBtn, True); } else { freeInspector(panel); } if (result) wfree(file); }
static void chooseIconCallback(WMWidget * self, void *clientData) { char *file; AppSettingsPanel *panel = (AppSettingsPanel *) clientData; int result; panel->choosingIcon = 1; WMSetButtonEnabled(panel->browseBtn, False); result = wIconChooserDialog(panel->wwin->screen_ptr, &file, panel->editedIcon->wm_instance, panel->editedIcon->wm_class); panel->choosingIcon = 0; if (!panel->destroyed) { if (result) { WMSetTextFieldText(panel->iconField, file); wfree(file); updateSettingsPanelIcon(panel); } WMSetButtonEnabled(panel->browseBtn, True); } else { /* kluge for the case, the user asked to close the panel before * the icon chooser */ DestroyDockAppSettingsPanel(panel); } }
static void setIconCallback(WMenu *menu, WMenuEntry *entry) { WAppIcon *icon = ((WApplication *) entry->clientdata)->app_icon; char *file = NULL; virtual_screen *vscr; int result; /* Parameter not used, but tell the compiler that it is ok */ (void) menu; assert(icon != NULL); if (icon->editing) return; icon->editing = 1; vscr = icon->icon->vscr; wretain(icon); result = wIconChooserDialog(NULL, NULL, icon, &file); if (result) { if (!icon->destroyed) { if (!wIconChangeImageFile(icon->icon, file)) { wMessageDialog(vscr, _("Error"), _("Could not open specified icon file"), _("OK"), NULL, NULL); } else { wDefaultChangeIcon(icon->wm_instance, icon->wm_class, file); wAppIconPaint(icon); } } if (file) wfree(file); } icon->editing = 0; wrelease(icon); }
static void setIconCallback(WMenu *menu, WMenuEntry *entry) { WAppIcon *icon = ((WApplication*)entry->clientdata)->app_icon; char *file=NULL; WScreen *scr; int result; assert(icon!=NULL); if (icon->editing) return; icon->editing = 1; scr = icon->icon->core->screen_ptr; wretain(icon); result = wIconChooserDialog(scr, &file, icon->wm_instance, icon->wm_class); if (result && !icon->destroyed) { if (file && *file==0) { wfree(file); file = NULL; } if (!wIconChangeImageFile(icon->icon, file)) { wMessageDialog(scr, _("Error"), _("Could not open specified icon file"), _("OK"), NULL, NULL); } else { wDefaultChangeIcon(scr, icon->wm_instance, icon->wm_class, file); wAppIconPaint(icon); } if (file) wfree(file); } icon->editing = 0; wrelease(icon); }