SF.net SVN: geany-plugins:[937] trunk/geany-plugins/geanylua

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Sep 16 11:31:53 UTC 2009


Revision: 937
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=937&view=rev
Author:   ntrel
Date:     2009-09-16 11:31:53 +0000 (Wed, 16 Sep 2009)

Log Message:
-----------
Fix tab indentation.
Remove trailing space.
Add comment about not using yes/no buttons in dialogs.

Modified Paths:
--------------
    trunk/geany-plugins/geanylua/geanylua.c
    trunk/geany-plugins/geanylua/glspi_app.c
    trunk/geany-plugins/geanylua/glspi_dlg.c
    trunk/geany-plugins/geanylua/glspi_doc.c
    trunk/geany-plugins/geanylua/glspi_init.c
    trunk/geany-plugins/geanylua/glspi_kfile.c
    trunk/geany-plugins/geanylua/glspi_run.c
    trunk/geany-plugins/geanylua/glspi_sci.c
    trunk/geany-plugins/geanylua/gsdlg.c
    trunk/geany-plugins/geanylua/gsdlg.h

Modified: trunk/geany-plugins/geanylua/geanylua.c
===================================================================
--- trunk/geany-plugins/geanylua/geanylua.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/geanylua.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -78,10 +78,10 @@
 
 
 /*
-  It seems to me like we could simply pass the callbacks pointer directly
-  from the support library to the application. But for some reason that
-  doesn't work at all. So we make a copy of the callbacks array here,
-  and all is well...
+	It seems to me like we could simply pass the callbacks pointer directly
+	from the support library to the application. But for some reason that
+	doesn't work at all. So we make a copy of the callbacks array here,
+	and all is well...
 */
 PLUGIN_EXPORT
 PluginCallback	plugin_callbacks[8] = {

Modified: trunk/geany-plugins/geanylua/glspi_app.c
===================================================================
--- trunk/geany-plugins/geanylua/glspi_app.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/glspi_app.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -395,8 +395,8 @@
 	if ( !he ) {
 		lua_pushfstring(
 			L, _( "Error in module \"%s\" at function %s():\n"
-						"unknown command \"%s\" given for argument #1.\n"),
-						 LUA_MODULE_NAME, &__FUNCTION__[6], lua_tostring(L,1));
+				"unknown command \"%s\" given for argument #1.\n"),
+			LUA_MODULE_NAME, &__FUNCTION__[6], lua_tostring(L,1));
 		lua_error(L);
 		return 0;
 	}
@@ -424,7 +424,7 @@
 	g_strfreev(argv);
 	lua_pushboolean(L,rv);
 	if (rv) { return 1; }
-  lua_pushstring(L,err->message);
+	lua_pushstring(L,err->message);
 	g_error_free(err);
 	return 2;
 }

Modified: trunk/geany-plugins/geanylua/glspi_dlg.c
===================================================================
--- trunk/geany-plugins/geanylua/glspi_dlg.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/glspi_dlg.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -56,8 +56,8 @@
 
 
 /*
-  The GtkMessageDialog wants format strings, but we want literals.
-  So we need to replace all '%' with "%%"
+	The GtkMessageDialog wants format strings, but we want literals.
+	So we need to replace all '%' with "%%"
 */
 static gchar*pct_esc(const gchar*s)
 {
@@ -164,7 +164,7 @@
 
 	scroll=gtk_scrolled_window_new(NULL, NULL);
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
-	  GTK_POLICY_AUTOMATIC,  GTK_POLICY_AUTOMATIC);
+		GTK_POLICY_AUTOMATIC,  GTK_POLICY_AUTOMATIC);
 	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),scroll);
 	gtk_container_add(GTK_CONTAINER(scroll),tree);
 
@@ -252,6 +252,7 @@
 	gtk_widget_grab_default(dv==GTK_RESPONSE_YES?yes_btn:no_btn);
 	/* Where I come from, we ask "yes-or-no?"
 	 *  who the hell ever asks "no-or-yes?" ??? */
+	/* It's probably better to use descriptive names for button text -ntrel */
 	gtk_dialog_set_alternative_button_order(GTK_DIALOG(dialog),
 		GTK_RESPONSE_YES,GTK_RESPONSE_NO );
 	set_dialog_title(L,dialog);
@@ -393,7 +394,7 @@
 			}
 		}
 	}
-  if (patterns) { g_strfreev(patterns); }
+	if (patterns) { g_strfreev(patterns); }
 	return TRUE;
 }
 
@@ -434,11 +435,11 @@
 		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dlg), path);
 	}
 	if (!create_file_filter(L, GTK_FILE_CHOOSER(dlg), mask)) {
-     lua_pushfstring(L, _("Error in module \"%s\" at function pickfile():\n"
-             "failed to parse filter string at argument #3.\n "),
-     LUA_MODULE_NAME);
-     lua_error(L);
-     return NULL;
+		lua_pushfstring(L, _("Error in module \"%s\" at function pickfile():\n"
+			"failed to parse filter string at argument #3.\n "),
+			LUA_MODULE_NAME);
+		lua_error(L);
+		return NULL;
 	}
 
 #if NEED_OVERWRITE_PROMPT

Modified: trunk/geany-plugins/geanylua/glspi_doc.c
===================================================================
--- trunk/geany-plugins/geanylua/glspi_doc.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/glspi_doc.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -44,8 +44,8 @@
 
 
 /*
-  Try to find the geany->documents_array index of the specified filename.
-  Returns -1 if the filename doesn't match any open tabs.
+	Try to find the geany->documents_array index of the specified filename.
+	Returns -1 if the filename doesn't match any open tabs.
 */
 static gint filename_to_doc_idx(const gchar*fn)
 {
@@ -72,7 +72,7 @@
 
 /* Returns the filename of the specified document, or NULL on bad index */
 static const gchar* doc_idx_to_filename(gint idx) {
-	 if ( (idx >= 0 ) && ( ((guint)idx) < geany->documents_array->len ) ) {
+	if ( (idx >= 0 ) && ( ((guint)idx) < geany->documents_array->len ) ) {
 		GeanyDocument *doc=g_ptr_array_index(geany->documents_array, idx);
 		if (doc) { return doc->file_name?doc->file_name:GEANY_STRING_UNTITLED; }
 	}
@@ -104,7 +104,7 @@
 		}
 	}
 	if (idx>=0) {
-	  if (idx!=gtk_notebook_get_current_page(NOTEBOOK)) {
+		if (idx!=gtk_notebook_get_current_page(NOTEBOOK)) {
 			gtk_notebook_set_current_page(NOTEBOOK, idx);
 		}
 	}

Modified: trunk/geany-plugins/geanylua/glspi_init.c
===================================================================
--- trunk/geany-plugins/geanylua/glspi_init.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/glspi_init.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -69,9 +69,9 @@
 /* Called by Geany, run a script associated with a keybinding. */
 static void kb_activate(guint key_id)
 {
-  if ((key_id<MAX_HOT_KEYS) && KS[key_id]) {
+	if ((key_id<MAX_HOT_KEYS) && KS[key_id]) {
 		glspi_run_script(KS[key_id],0,NULL,SD);
-  }
+	}
 }
 
 /* Convert a script filename into a "pretty-printed" menu label. */
@@ -80,7 +80,7 @@
 	gint i;
 
 	if (isdigit(label[0])&&isdigit(label[1])&&('.'==label[2])&&(label[3])) {
-    memmove(label,label+3,strlen(label)-2);
+		memmove(label,label+3,strlen(label)-2);
 	}
 	/* Capitalize first char of menu label */
 	if (('_'==label[0])&&(label[1])) { /* Skip leading underscore */
@@ -278,8 +278,8 @@
 /*
 	Check if the script file begins with a special comment in the form:
 	-- @ACCEL@ <Modifiers>key
-  If we find one, parse it, and bind that key combo to its menu item.
-  See gtk_accelerator_parse() doc for more info on accel syntax...
+	If we find one, parse it, and bind that key combo to its menu item.
+	See gtk_accelerator_parse() doc for more info on accel syntax...
 */
 static void assign_accel(GtkWidget*w, char*fn)
 {
@@ -575,10 +575,10 @@
 }
 
 static gint glspi_rescan(lua_State* L) {
-  remove_menu();
-  build_menu();
+	remove_menu();
+	build_menu();
 	hotkey_init();
-  return 0;
+	return 0;
 }
 
 static const struct luaL_reg glspi_mnu_funcs[] = {

Modified: trunk/geany-plugins/geanylua/glspi_kfile.c
===================================================================
--- trunk/geany-plugins/geanylua/glspi_kfile.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/glspi_kfile.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -162,7 +162,7 @@
 
 
 /*
-  Lua "closure" function to iterate through each string in an array of strings
+	Lua "closure" function to iterate through each string in an array of strings
 */
 static gint strings_closure(lua_State *L)
 {

Modified: trunk/geany-plugins/geanylua/glspi_run.c
===================================================================
--- trunk/geany-plugins/geanylua/glspi_run.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/glspi_run.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -34,12 +34,12 @@
 
 
 /*
-  If a script gets caught in a tight loop and the timeout expires,
-  and the user confirms they want to keep waiting, for some reason
-  the normal methods for repainting the window don't work in the
-  editor window, which makes it appear as if the dialog is still
-  active. So we need to tell scintilla to paint over the spot
-  where the dialog was.
+	If a script gets caught in a tight loop and the timeout expires,
+	and the user confirms they want to keep waiting, for some reason
+	the normal methods for repainting the window don't work in the
+	editor window, which makes it appear as if the dialog is still
+	active. So we need to tell scintilla to paint over the spot
+	where the dialog was.
 */
 static void repaint_scintilla(void)
 {
@@ -95,13 +95,13 @@
 
 
 /*
-  Display a message box showing any script error...
-  Depending on the type of error, Lua will sometimes prepend the filename
-  to the message. If need_name is TRUE then we assume that Lua didn't add
-  the filename, so we prepend it ourself. If need_name is FALSE, then the
-  error message likely contains a filename *and* a line number, so we
-  give the user an option to automatically open the file and scroll to
-  the offending line.
+	Display a message box showing any script error...
+	Depending on the type of error, Lua will sometimes prepend the filename
+	to the message. If need_name is TRUE then we assume that Lua didn't add
+	the filename, so we prepend it ourself. If need_name is FALSE, then the
+	error message likely contains a filename *and* a line number, so we
+	give the user an option to automatically open the file and scroll to
+	the offending line.
 */
 static void glspi_script_error(gchar *script_file, const gchar *msg, gboolean need_name, gint line)
 {
@@ -141,7 +141,7 @@
 	gint counter;
 	gdouble remaining;
 	gdouble max;
-  gboolean optimized;
+	gboolean optimized;
 } StateInfo;
 
 static GSList *state_list=NULL;
@@ -241,10 +241,10 @@
 
 
 /*
-  Pause the run timer, while dialogs are displayed. Note that we
-  purposely add 1/10 of a second to our elapsed time here.
-  That should not even be noticeable for most scripts, but
-  it helps us time-out faster for dialogs caught in a loop.
+	Pause the run timer, while dialogs are displayed. Note that we
+	purposely add 1/10 of a second to our elapsed time here.
+	That should not even be noticeable for most scripts, but
+	it helps us time-out faster for dialogs caught in a loop.
 */
 
 static void glspi_pause_timer(gboolean pause, gpointer user_data)
@@ -333,7 +333,7 @@
 }
 
 /*
-  The set_*_token functions assign default values for module-level variables
+	The set_*_token functions assign default values for module-level variables
 */
 
 static void set_string_token(lua_State *L, gchar*name, gchar*value)
@@ -436,10 +436,10 @@
 
 
 /*
-  Function to load this module into the standalone lua interpreter.
-  The only reason you would ever want to do this is to re-generate
-  the "keywords.list" file from the command line.
-  See the file "util/keywords.lua" for more info.
+	Function to load this module into the standalone lua interpreter.
+	The only reason you would ever want to do this is to re-generate
+	the "keywords.list" file from the command line.
+	See the file "util/keywords.lua" for more info.
 */
 PLUGIN_EXPORT
 gint luaopen_libgeanylua(lua_State *L)

Modified: trunk/geany-plugins/geanylua/glspi_sci.c
===================================================================
--- trunk/geany-plugins/geanylua/glspi_sci.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/glspi_sci.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -158,7 +158,7 @@
 
 
 /*
-  Translate between rectangular (line/column) and linear (position) locations.
+	Translate between rectangular (line/column) and linear (position) locations.
 */
 static gint glspi_rowcol(lua_State* L)
 {
@@ -269,8 +269,8 @@
 
 
 /*
-  Pushes the line of text onto the Lua stack from the specified
-  line number. Return FALSE only if the index is out of bounds.
+	Pushes the line of text onto the Lua stack from the specified
+	line number. Return FALSE only if the index is out of bounds.
 */
 static gchar* get_line_text(GeanyDocument*doc,gint linenum)
 {
@@ -286,7 +286,7 @@
 
 
 /*
-  Lua "closure" function to iterate through each line in the current document
+	Lua "closure" function to iterate through each line in the current document
 */
 static gint lines_closure(lua_State *L)
 {
@@ -312,10 +312,10 @@
 {
 	DOC_REQUIRED
 	if (lua_gettop(L)==0) {
-	  push_number(L,0);
+		push_number(L,0);
 		lua_pushlightuserdata(L,doc); /* Pass the doc pointer to our iterator */
-	  lua_pushcclosure(L, &lines_closure, 2);
-	  return 1;
+		lua_pushcclosure(L, &lines_closure, 2);
+		return 1;
 	} else {
 		int idx;
 		gchar *text;
@@ -425,7 +425,7 @@
 	if ( SCI_NULL == scicmd ) {
 		lua_pushfstring(
 			L, _( "Error in module \"%s\" at function navigate():\n"
-					  "unknown navigation mode \"%s\" for argument #1.\n"),
+						"unknown navigation mode \"%s\" for argument #1.\n"),
 						LUA_MODULE_NAME, strcmd);
 		lua_error(L);
 	} else {
@@ -599,9 +599,9 @@
 static gint glspi_fail_not_implemented(lua_State* L, const gchar*funcname, gchar*cmdname)
 {
 	lua_pushfstring(
-			L, _( "Error in module \"%s\" at function %s():\n"
-						"API command \"%s\" not implemented.\n"),
-						 LUA_MODULE_NAME, &funcname[6], cmdname);
+		L, _( "Error in module \"%s\" at function %s():\n"
+			"API command \"%s\" not implemented.\n"),
+		LUA_MODULE_NAME, &funcname[6], cmdname);
 	lua_error(L);
 	return 0;
 }
@@ -610,9 +610,9 @@
 static gint glspi_fail_arg_count(lua_State* L, const gchar*funcname, gchar*cmdname)
 {
 	lua_pushfstring(
-			L, _( "Error in module \"%s\" at function %s():\n"
-						"not enough arguments for command \"%s\".\n"),
-						 LUA_MODULE_NAME, &funcname[6], cmdname);
+		L, _( "Error in module \"%s\" at function %s():\n"
+			"not enough arguments for command \"%s\".\n"),
+		LUA_MODULE_NAME, &funcname[6], cmdname);
 	lua_error(L);
 	return 0;
 }
@@ -644,13 +644,13 @@
 			strncpy(cmdbuf,lua_tostring(L,1),sizeof(cmdbuf)-1);
 			for (i=0;cmdbuf[i];i++) {cmdbuf[i]=g_ascii_toupper(cmdbuf[i]);}
 			he=lookup_cmd_str((strncmp(cmdbuf,"SCI_",4)==0)?&cmdbuf[4]:cmdbuf);
-	  } else { return FAIL_STRING_ARG(1); }
+		} else { return FAIL_STRING_ARG(1); }
 	}
 	if ( !he ) {
 		lua_pushfstring(
 			L, _( "Error in module \"%s\" at function %s():\n"
-						"unknown command \"%s\" given for argument #1.\n"),
-						 LUA_MODULE_NAME, &__FUNCTION__[6], lua_tostring(L,1));
+				"unknown command \"%s\" given for argument #1.\n"),
+			LUA_MODULE_NAME, &__FUNCTION__[6], lua_tostring(L,1));
 		lua_error(L);
 		return 0;
 	}
@@ -725,7 +725,7 @@
 				lua_pushnil(L);
 				return 1;
 			}
-		  break;
+			break;
 		case SLT_FINDTEXT: return FAIL_API;
 		case SLT_FORMATRANGE: return FAIL_API;
 		default:return FAIL_API;

Modified: trunk/geany-plugins/geanylua/gsdlg.c
===================================================================
--- trunk/geany-plugins/geanylua/gsdlg.c	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/gsdlg.c	2009-09-16 11:31:53 UTC (rev 937)
@@ -64,7 +64,7 @@
 	}
 	sw=gtk_scrolled_window_new(NULL, NULL);
 	gtk_widget_set_usize(sw, gdk_screen_get_width(gdk_screen_get_default())/3,
-												   gdk_screen_get_height(gdk_screen_get_default())/10);
+		gdk_screen_get_height(gdk_screen_get_default())/10);
 	gtk_container_add(GTK_CONTAINER(sw),tv);
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 	frm=gtk_frame_new(label);
@@ -372,7 +372,7 @@
 		vbox=gtk_vbox_new(FALSE,FALSE);
 		gtk_container_add(GTK_CONTAINER(frm),vbox);
 		gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dlg)->vbox),frm);
-	} 
+	}
 
 	/* Frame holds keyname, vbox holds default value */
 	g_object_set_data_full(G_OBJECT(frm),  TextKey, g_strdup(key), g_free);
@@ -505,7 +505,7 @@
 void gsdlg_hr(GtkDialog *dlg)
 {
 	g_return_if_fail(dlg);
-	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dlg)->vbox), gtk_hseparator_new()); 
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dlg)->vbox), gtk_hseparator_new());
 }
 
 
@@ -585,10 +585,10 @@
 static GsDlgRunHook gsdlg_run_hook=NULL;
 
 
-#ifndef DIALOG_LIB 
+#ifndef DIALOG_LIB
 void gsdlg_set_run_hook(GsDlgRunHook cb)
 {
-  gsdlg_run_hook=cb;
+	gsdlg_run_hook=cb;
 }
 #endif
 

Modified: trunk/geany-plugins/geanylua/gsdlg.h
===================================================================
--- trunk/geany-plugins/geanylua/gsdlg.h	2009-09-16 11:08:45 UTC (rev 936)
+++ trunk/geany-plugins/geanylua/gsdlg.h	2009-09-16 11:31:53 UTC (rev 937)
@@ -71,9 +71,9 @@
 typedef void (*GsDlgRunHook) (gboolean running, gpointer user_data);
 
 /*
-  If assigned, the cb callback will be called twice by gsdlg_run(),
-  first with running=TRUE when the dialog is displayed, and
-  then with running=FALSE when it is dismissed.
+	If assigned, the cb callback will be called twice by gsdlg_run(),
+	first with running=TRUE when the dialog is displayed, and
+	then with running=FALSE when it is dismissed.
 */
 #ifndef DIALOG_LIB
 GSDLG_API void gsdlg_set_run_hook(GsDlgRunHook cb);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list