static gboolean properties (QCADDesignObject *obj, GtkWidget *parent) #endif /* UNDO_REDO */ { static PROPERTIES dialog = {NULL} ; gboolean bRet = FALSE ; if (!IS_QCAD_LABEL (obj)) return FALSE ; if (NULL == dialog.dlg) create_properties_dialog (&dialog) ; gtk_window_set_transient_for (GTK_WINDOW (dialog.dlg), GTK_WINDOW (parent)) ; gtk_entry_set_text (GTK_ENTRY (dialog.txtLabel), QCAD_LABEL (obj)->psz) ; gtk_widget_grab_focus (dialog.txtLabel) ; if ((bRet = (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (dialog.dlg))))) { if (NULL != QCAD_LABEL (obj)->psz) g_free (QCAD_LABEL (obj)->psz) ; QCAD_LABEL (obj)->psz = gtk_editable_get_chars (GTK_EDITABLE (dialog.txtLabel), 0, -1) ; QCAD_LABEL (obj)->bNeedsEPMDraw = TRUE ; } #ifdef UNDO_REDO if (NULL != pentry) (*pentry) = NULL ; #endif /* def UNDO_REDO */ gtk_widget_hide (dialog.dlg) ; return bRet ; }
static void show_project_properties(gboolean show_build) { GeanyProject *p = app->project; GtkWidget *widget = NULL; GtkWidget *radio_long_line_custom; static PropertyDialogElements e; GSList *node; g_return_if_fail(app->project != NULL); entries_modified = FALSE; if (e.dialog == NULL) create_properties_dialog(&e); insert_build_page(&e); foreach_slist(node, stash_groups) stash_group_display(node->data, e.dialog); /* fill the elements with the appropriate data */ gtk_entry_set_text(GTK_ENTRY(e.name), p->name); gtk_label_set_text(GTK_LABEL(e.file_name), p->file_name); gtk_entry_set_text(GTK_ENTRY(e.base_path), p->base_path); radio_long_line_custom = ui_lookup_widget(e.dialog, "radio_long_line_custom_project"); switch (p->long_line_behaviour) { case 0: widget = ui_lookup_widget(e.dialog, "radio_long_line_disabled_project"); break; case 1: widget = ui_lookup_widget(e.dialog, "radio_long_line_default_project"); break; case 2: widget = radio_long_line_custom; break; } gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE); widget = ui_lookup_widget(e.dialog, "spin_long_line_project"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), (gdouble)p->long_line_column); on_radio_long_line_custom_toggled(GTK_TOGGLE_BUTTON(radio_long_line_custom), widget); if (p->description != NULL) { /* set text */ GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(e.description)); gtk_text_buffer_set_text(buffer, p->description, -1); } if (p->file_patterns != NULL) { /* set the file patterns */ gchar *str; str = g_strjoinv(" ", p->file_patterns); gtk_entry_set_text(GTK_ENTRY(e.patterns), str); g_free(str); } g_signal_emit_by_name(geany_object, "project-dialog-open", e.notebook); gtk_widget_show_all(e.dialog); /* note: notebook page must be shown before setting current page */ if (show_build) gtk_notebook_set_current_page(GTK_NOTEBOOK(e.notebook), e.build_page_num); else gtk_notebook_set_current_page(GTK_NOTEBOOK(e.notebook), 0); while (gtk_dialog_run(GTK_DIALOG(e.dialog)) == GTK_RESPONSE_OK) { if (update_config(&e, FALSE)) { g_signal_emit_by_name(geany_object, "project-dialog-confirmed", e.notebook); if (!write_config(TRUE)) SHOW_ERR(_("Project file could not be written")); else { ui_set_statusbar(TRUE, _("Project \"%s\" saved."), app->project->name); break; } } } build_free_fields(e.build_properties); g_signal_emit_by_name(geany_object, "project-dialog-close", e.notebook); gtk_notebook_remove_page(GTK_NOTEBOOK(e.notebook), e.build_page_num); gtk_widget_hide(e.dialog); }