[geany/geany-plugins] dd1379: geanymacro: Retrieve the macro directly instead of looking it up
Colomban Wendling
git-noreply at xxxxx
Sat Mar 9 19:33:01 UTC 2013
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Sat, 09 Mar 2013 19:33:01 UTC
Commit: dd13796e4da33b32a33647852b552c1077eb69f2
https://github.com/geany/geany-plugins/commit/dd13796e4da33b32a33647852b552c1077eb69f2
Log Message:
-----------
geanymacro: Retrieve the macro directly instead of looking it up
Since the pointer to the macro is stored in the tree anyway, retrieve
it from the tree instead of retrieving the name an looking up for this
name.
Modified Paths:
--------------
geanymacro/src/geanymacro.c
Modified: geanymacro/src/geanymacro.c
15 files changed, 4 insertions(+), 11 deletions(-)
===================================================================
@@ -2053,7 +2053,6 @@ static void DoEditMacro(GtkMenuItem *menuitem, gpointer gdata)
GSList *gsl=mList;
Macro *m;
gchar *cTemp;
- gpointer bEditable;
/* create dialog box */
dialog=gtk_dialog_new_with_buttons(_("Edit Macros"),GTK_WINDOW(geany->main_widgets->window),
@@ -2137,14 +2136,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 +2153,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 +2174,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).
More information about the Plugins-Commits
mailing list