Revision: 866 http://svn.sourceforge.net/geany/?rev=866&view=rev Author: eht16 Date: 2006-10-04 12:14:57 -0700 (Wed, 04 Oct 2006)
Log Message: ----------- Fixed crash when using "Make object" on new files(closes #1570818).
Modified Paths: -------------- trunk/ChangeLog trunk/src/callbacks.c trunk/src/document.c trunk/src/filetypes.c trunk/src/filetypes.h trunk/src/main.c trunk/src/ui_utils.c trunk/src/ui_utils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-10-03 17:54:02 UTC (rev 865) +++ trunk/ChangeLog 2006-10-04 19:14:57 UTC (rev 866) @@ -1,3 +1,11 @@ +2006-10-04 Enrico Tröger enrico.troeger@uvena.de + + * src/ui_utils.c, src/main.c, src/document.c, src/callbacks.c: + Renamed ui_build_show_hide() in ui_update_build_menu(). + * src/filetypes.c, src/ui_utils.c: + Fixed crash when using "Make object" on new files(closes #1570818). + + 2006-10-03 Enrico Tröger enrico.troeger@uvena.de
* src/callbacks.c: Save configuration(i.e. list of open files) as late
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2006-10-03 17:54:02 UTC (rev 865) +++ trunk/src/callbacks.c 2006-10-04 19:14:57 UTC (rev 866) @@ -759,7 +759,7 @@
document_set_text_changed(idx); ui_document_show_hide(idx); // update the document menu - ui_build_show_hide(idx); + ui_update_build_menu(idx); ui_update_statusbar(idx, -1); ui_set_window_title(idx); ui_update_tag_list(idx, FALSE); @@ -930,7 +930,7 @@ utils_replace_filename(idx); document_save_file(idx, TRUE);
- ui_build_show_hide(idx); + ui_update_build_menu(idx);
// finally add current file to recent files menu ui_add_recent_file(doc_list[idx].file_name); @@ -1648,21 +1648,25 @@ case 2: //make object { gchar *locale_filename, *short_file, *noext, *object_file; //temp - locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
- short_file = g_path_get_basename(locale_filename); - g_free(locale_filename); + if (doc_list[idx].file_name != NULL) + { + locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
- noext = utils_remove_ext_from_filename(short_file); - g_free(short_file); + short_file = g_path_get_basename(locale_filename); + g_free(locale_filename);
- object_file = g_strdup_printf("%s.o", noext); - g_free(noext); + noext = utils_remove_ext_from_filename(short_file); + g_free(short_file);
- g_free(app->build_make_custopt); - app->build_make_custopt = g_strdup(object_file); - g_free(object_file); - make_object = TRUE; + object_file = g_strdup_printf("%s.o", noext); + g_free(noext); + + g_free(app->build_make_custopt); + app->build_make_custopt = g_strdup(object_file); + g_free(object_file); + make_object = TRUE; + } }
// fall through
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2006-10-03 17:54:02 UTC (rev 865) +++ trunk/src/document.c 2006-10-04 19:14:57 UTC (rev 866) @@ -354,7 +354,7 @@ ui_set_window_title(-1); ui_save_buttons_toggle(FALSE); ui_close_buttons_toggle(); - ui_build_show_hide(-1); + ui_update_build_menu(-1); } } else geany_debug("Error: idx: %d page_num: %d", idx, page_num); @@ -389,7 +389,7 @@ document_set_filetype(idx, ft); // also clears taglist if (ft == NULL) filetypes[GEANY_FILETYPES_ALL]->style_func_ptr(doc_list[idx].sci); ui_set_window_title(idx); - ui_build_show_hide(idx); + ui_update_build_menu(idx); doc_list[idx].mtime = time(NULL); doc_list[idx].changed = FALSE; document_set_text_changed(idx); @@ -666,7 +666,7 @@ sci_set_readonly(doc_list[idx].sci, readonly);
document_set_filetype(idx, use_ft); // also sets taglist - ui_build_show_hide(idx); + ui_update_build_menu(idx); } else { // reloading @@ -1197,7 +1197,7 @@ } } sci_colourise(doc_list[idx].sci, 0, -1); - ui_build_show_hide(idx); + ui_update_build_menu(idx); }
Modified: trunk/src/filetypes.c =================================================================== --- trunk/src/filetypes.c 2006-10-03 17:54:02 UTC (rev 865) +++ trunk/src/filetypes.c 2006-10-04 19:14:57 UTC (rev 866) @@ -805,6 +805,9 @@ if (filetypes[i]->menu_items->item_exec != NULL && GTK_IS_WIDGET(filetypes[i]->menu_items->item_exec)) gtk_widget_destroy(filetypes[i]->menu_items->item_exec); + if (filetypes[i]->menu_items->item_make_object != NULL && + GTK_IS_WIDGET(filetypes[i]->menu_items->item_make_object)) + gtk_widget_destroy(filetypes[i]->menu_items->item_make_object); */ g_free(filetypes[i]->menu_items);
g_strfreev(filetypes[i]->pattern); @@ -941,7 +944,7 @@ gchar *fname, *ext, *data;
if (! bp->modified) continue; - + ext = get_conf_extension(i); fname = g_strconcat(conf_prefix, ext, NULL); g_free(ext);
Modified: trunk/src/filetypes.h =================================================================== --- trunk/src/filetypes.h 2006-10-03 17:54:02 UTC (rev 865) +++ trunk/src/filetypes.h 2006-10-04 19:14:57 UTC (rev 866) @@ -70,6 +70,7 @@ GtkWidget *item_compile; GtkWidget *item_link; GtkWidget *item_exec; + GtkWidget *item_make_object; gboolean can_compile; gboolean can_link; gboolean can_exec;
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2006-10-03 17:54:02 UTC (rev 865) +++ trunk/src/main.c 2006-10-04 19:14:57 UTC (rev 866) @@ -608,7 +608,7 @@ idx = document_get_cur_idx(); gtk_widget_grab_focus(GTK_WIDGET(doc_list[idx].sci)); gtk_tree_model_foreach(GTK_TREE_MODEL(tv.store_openfiles), treeviews_find_node, GINT_TO_POINTER(idx)); - ui_build_show_hide(idx); + ui_update_build_menu(idx); ui_update_tag_list(idx, FALSE);
#ifdef G_OS_WIN32
Modified: trunk/src/ui_utils.c =================================================================== --- trunk/src/ui_utils.c 2006-10-03 17:54:02 UTC (rev 865) +++ trunk/src/ui_utils.c 2006-10-04 19:14:57 UTC (rev 866) @@ -618,7 +618,7 @@ }
-void ui_build_show_hide(gint idx) +void ui_update_build_menu(gint idx) { gboolean is_header = FALSE; gchar *ext = NULL; @@ -671,7 +671,7 @@ gtk_menu_item_set_submenu(GTK_MENU_ITEM(lookup_widget(app->window, "menu_build1")), ft->menu_items->menu);
- if (is_header) + if (is_header) // means also filename is NULL { gtk_widget_set_sensitive(app->compile_button, FALSE); gtk_widget_set_sensitive(app->run_button, FALSE); @@ -681,6 +681,7 @@ gtk_widget_set_sensitive(ft->menu_items->item_link, FALSE); if (ft->menu_items->can_exec) gtk_widget_set_sensitive(ft->menu_items->item_exec, FALSE); + gtk_widget_set_sensitive(ft->menu_items->item_make_object, FALSE); } else { @@ -692,8 +693,8 @@ gtk_widget_set_sensitive(ft->menu_items->item_link, TRUE); if (ft->menu_items->can_exec) gtk_widget_set_sensitive(ft->menu_items->item_exec, TRUE); + gtk_widget_set_sensitive(ft->menu_items->item_make_object, TRUE); } - break; } case GEANY_FILETYPES_LATEX: @@ -709,7 +710,7 @@ ft->menu_items->menu); gtk_widget_set_sensitive(app->compile_button, FALSE); gtk_widget_set_sensitive(app->run_button, FALSE); - } + } else { gtk_menu_item_set_submenu(GTK_MENU_ITEM(lookup_widget(app->window, "menu_build1")), @@ -738,6 +739,7 @@ if (ft->menu_items->can_link) gtk_widget_set_sensitive(ft->menu_items->item_link, FALSE); if (ft->menu_items->can_exec) gtk_widget_set_sensitive(ft->menu_items->item_exec, FALSE); + gtk_widget_set_sensitive(ft->menu_items->item_make_object, FALSE); } else { @@ -751,6 +753,7 @@ gtk_widget_set_sensitive(ft->menu_items->item_link, TRUE); if (ft->menu_items->can_exec) gtk_widget_set_sensitive(ft->menu_items->item_exec, TRUE); + gtk_widget_set_sensitive(ft->menu_items->item_make_object, TRUE); } } } @@ -832,6 +835,7 @@ gtk_tooltips_set_tip(tooltips, item, _("Compiles the current file using the " "make tool"), NULL); g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_make_activate), GINT_TO_POINTER(2)); + ft->menu_items->item_make_object = item; #endif
if (ft->menu_items->can_exec) @@ -1378,7 +1382,7 @@
align = gtk_alignment_new (0.5, 0.5, 1, 1); gtk_container_add (GTK_CONTAINER (frame), align); - gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 12, 0); + gtk_alignment_set_padding (GTK_ALIGNMENT (align), 0, 0, 12, 0);
label_markup = g_strconcat("<b>", label_text, "</b>", NULL); label = gtk_label_new (label_markup);
Modified: trunk/src/ui_utils.h =================================================================== --- trunk/src/ui_utils.h 2006-10-03 17:54:02 UTC (rev 865) +++ trunk/src/ui_utils.h 2006-10-04 19:14:57 UTC (rev 866) @@ -68,7 +68,7 @@
void ui_widget_show_hide(GtkWidget *widget, gboolean show);
-void ui_build_show_hide(gint); +void ui_update_build_menu(gint);
void ui_treeviews_show_hide(gboolean force);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.