Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sat, 09 Mar 2013 20:58:40 UTC Commit: 3022591069dcd9ca6f66888f62c90a74c8c2a6ac https://github.com/geany/geany-plugins/commit/3022591069dcd9ca6f66888f62c90a...
Log Message: ----------- Merge branch 'geanymacro/fixes'
Modified Paths: -------------- geanymacro/src/geanymacro.c
Modified: geanymacro/src/geanymacro.c 48 files changed, 24 insertions(+), 24 deletions(-) =================================================================== @@ -147,9 +147,9 @@ {SCI_SELECTIONDUPLICATE,N_("Insert duplicate of selected text after selection. If nothing selected,\ duplicate line")},
-{SCI_SEARCHNEXT,"Search for next """}, -{SCI_SEARCHPREV,"Search for previous """}, -{SCI_SEARCHANCHOR,"Set start of search to beginning of selection"}, +{SCI_SEARCHNEXT,N_("Search for next """)}, +{SCI_SEARCHPREV,N_("Search for previous """)}, +{SCI_SEARCHANCHOR,N_("Set start of search to beginning of selection")},
/* editor commands that don't seem to work well in editing * {SCI_FORMFEED,N_("FormFeed")}, @@ -571,7 +571,7 @@ static gboolean Notification_Handler(GObject *obj,GeanyEditor *ed,SCNotification static gchar *GetPretyKeyName(guint keyval,guint state) { gboolean bAlt,bCtrl,bShift; - gchar *cTemp; + const gchar *cTemp; gchar *cName; gchar *cPretyName;
@@ -1562,9 +1562,8 @@ static void EditSCIREPLACESELText(GtkTreeModel *model,GtkTreeIter *iter) /* handle change in text */
/* first free old text */ - gtk_tree_model_get(model,iter,0,&cTemp2,3,&cTemp,-1); + gtk_tree_model_get(model,iter,3,&cTemp,-1); g_free(cTemp); - g_free(cTemp2);
/* get new text */ cTemp=g_strdup((gchar*)gtk_entry_get_text((GtkEntry*)(gtke))); @@ -1573,6 +1572,8 @@ static void EditSCIREPLACESELText(GtkTreeModel *model,GtkTreeIter *iter) /* set text */ gtk_list_store_set(GTK_LIST_STORE(model),iter,0,cTemp2,3,cTemp,-1);
+ g_free(cTemp2); + /* break out of loop */ break; } @@ -1597,7 +1598,7 @@ static void combo_edited(GtkCellRendererText *cell,gchar *iter_id,gchar *new_tex
/* find MacroDetails that has the setting of new setting */ i=0; - while(strcmp(MacroDetails[i].description,new_text)!=0) + while(strcmp(_(MacroDetails[i].description),new_text)!=0) i++;
/* Get the iterator for treeview*/ @@ -1618,7 +1619,6 @@ static void combo_edited(GtkCellRendererText *cell,gchar *iter_id,gchar *new_tex }
/* see what text will have to change into */ - cTemp=(gchar*)(MacroDetails[i].description); cTemp2=NULL; if(MacroDetails[i].message==SCI_REPLACESEL) { @@ -1632,10 +1632,14 @@ static void combo_edited(GtkCellRendererText *cell,gchar *iter_id,gchar *new_tex cTemp2=g_strdup("0,"); bNeedButtonUpdate=TRUE; } + else + cTemp=g_strdup(_(MacroDetails[i].description));
/* Update the model */ gtk_list_store_set(GTK_LIST_STORE(model),&iter,0,cTemp,2,&(MacroDetails[i]),3,cTemp2,-1);
+ g_free(cTemp); + /* check if changing to or from SCI_REPLACESEL and enable/disable edit button as needed */ if(bNeedButtonUpdate) g_signal_emit_by_name(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),"changed", @@ -1748,7 +1752,6 @@ static void EditMacroElements(Macro *m)
gtk_list_store_append(ls,&iter); /* Acquire an iterator */ /* set text, pointer to macro detail, and any ascociated string */ - cTemp=(gchar*)(MacroDetails[i].description); cTemp2=NULL; if(me->message==SCI_REPLACESEL) { @@ -1764,9 +1767,13 @@ static void EditMacroElements(Macro *m) cTemp2=g_strdup_printf("%lu,%s",me->wparam,((gchar*)(me->lparam)==NULL)? "":((gchar*)(me->lparam))); } + else + cTemp=g_strdup(_(MacroDetails[i].description));
gtk_list_store_set(ls,&iter,0,cTemp,2,&(MacroDetails[i]),3,cTemp2,-1); gsl=g_slist_next(gsl); + + g_free(cTemp); }
/* create list store for combo renderer */ @@ -1775,7 +1782,7 @@ static void EditMacroElements(Macro *m) while(MacroDetails[i].description!=NULL) { gtk_list_store_append(lsCombo,&iter); - gtk_list_store_set(lsCombo,&iter,0,MacroDetails[i].description,1, + gtk_list_store_set(lsCombo,&iter,0,_(MacroDetails[i].description),1, &(MacroDetails[i]),-1); i++; } @@ -1898,7 +1905,7 @@ static void EditMacroElements(Macro *m) if(i==GEANY_MACRO_BUTTON_ABOVE) { gtk_list_store_append(ls,&iterNew); - gtk_list_store_set(ls,&iterNew,0,MacroDetails[0].description,2,&(MacroDetails[0]),3,NULL, + gtk_list_store_set(ls,&iterNew,0,_(MacroDetails[0].description),2,&(MacroDetails[0]),3,NULL, -1); gtk_list_store_move_before(ls,&iterNew,&iter);
@@ -1910,7 +1917,7 @@ static void EditMacroElements(Macro *m) if(i==GEANY_MACRO_BUTTON_BELOW) { gtk_list_store_append(ls,&iterNew); - gtk_list_store_set(ls,&iterNew,0,MacroDetails[0].description,2,&(MacroDetails[0]),3,NULL, + gtk_list_store_set(ls,&iterNew,0,_(MacroDetails[0].description),2,&(MacroDetails[0]),3,NULL, -1); gtk_list_store_move_after(ls,&iterNew,&iter);
@@ -1935,7 +1942,7 @@ static void EditMacroElements(Macro *m) gtk_tree_model_iter_n_children(GTK_TREE_MODEL(ls),NULL)==0) { gtk_list_store_append(ls,&iterNew); - gtk_list_store_set(ls,&iterNew,0,MacroDetails[0].description,2,&(MacroDetails[0]),3,NULL,-1); + gtk_list_store_set(ls,&iterNew,0,_(MacroDetails[0].description),2,&(MacroDetails[0]),3,NULL,-1);
/* call callback: this will update buttons acordingly */ DoEditMacroElementsSelectionChanged(selection,dialog); @@ -2053,7 +2060,6 @@ static void DoEditMacro(GtkMenuItem *menuitem, gpointer gdata) GSList *gsl=mList; Macro *m; gchar *cTemp; - gboolean bEditable;
/* create dialog box */ dialog=gtk_dialog_new_with_buttons(_("Edit Macros"),GTK_WINDOW(geany->main_widgets->window), @@ -2137,14 +2143,13 @@ static void DoEditMacro(GtkMenuItem *menuitem, gpointer gdata) if(gtk_tree_selection_get_selected(selection,NULL,&iter)) { /* get macro name */ - gtk_tree_model_get(GTK_TREE_MODEL(ls),&iter,0,&cTemp,2,&bEditable,-1); + gtk_tree_model_get(GTK_TREE_MODEL(ls),&iter,2,&m,-1); /* handle delete macro */ - if(i==GEANY_MACRO_BUTTON_DELETE && bEditable) + if(i==GEANY_MACRO_BUTTON_DELETE && m) { /* remove from table */ gtk_list_store_remove(GTK_LIST_STORE(ls),&iter); /* remove macro */ - m=FindMacroByName(cTemp); RemoveMacroFromList(m); FreeMacro(m); /* Signal that macros have changed (and need to be saved) */ @@ -2155,9 +2160,8 @@ static void DoEditMacro(GtkMenuItem *menuitem, gpointer gdata) }
/* handle re-record macro */ - if(i==GEANY_MACRO_BUTTON_RERECORD && bEditable && DocumentPresent()) + if(i==GEANY_MACRO_BUTTON_RERECORD && m && DocumentPresent()) { - m=FindMacroByName(cTemp); /* ensure have empty recording macro */ FreeMacro(RecordingMacro); RecordingMacro=CreateMacro(); @@ -2177,16 +2181,12 @@ static void DoEditMacro(GtkMenuItem *menuitem, gpointer gdata) }
/* handle edit macro */ - if(i==GEANY_MACRO_BUTTON_EDIT && bEditable) + if(i==GEANY_MACRO_BUTTON_EDIT && m) { - m=FindMacroByName(cTemp); EditMacroElements(m); /* Signal that macros have changed (and need to be saved) */ bMacrosHaveChanged=TRUE; } - - /* free memory */ - g_free(cTemp); }
}
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).