← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n] Rev 392: Merge with trunk

 

Merge authors:
  Steven Sheehy (steven-sheehy)
------------------------------------------------------------
revno: 392 [merge]
committer: Steven Sheehy <steven.sheehy@xxxxxxxxx>
branch nick: linuxdcpp-i18n
timestamp: Thu 2010-10-14 01:00:38 -0500
message:
  Merge with trunk
modified:
  Changelog.txt
  Credits.txt
  SConstruct
  debian/changelog
  glade/mainwindow.glade
  linux/SConscript
  linux/UserCommandMenu.cc
  linux/UserCommandMenu.hh
  linux/search.cc
  linux/sharebrowser.cc
  linux/version.cc


--
lp:~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n

Your team LinuxDC++ Team is subscribed to branch lp:~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/linuxdcpp-i18n/+edit-subscription
=== modified file 'Changelog.txt'
--- Changelog.txt	2010-10-11 06:05:22 +0000
+++ Changelog.txt	2010-10-14 06:00:38 +0000
@@ -61,6 +61,7 @@
 [2010-09-05] lp#308683: Fixed downloading files multiple times when grouping by TTH. (Steven)
 [2010-09-07] Added icons to the notebook tab labels. (Steven)
 [2010-09-09] PM tab label now shows when user's nick, hub or online status changes. (Steven)
+[2010-10-13] Added file path (fileFN) and magnet (fileMN) variables to user commands. (thanks DjSlash)
 
 *** 1.0.3 2009-02-01 ***
 [2008-08-10] lp#256236: Fixed a crash on startup when using auto-open options.

=== modified file 'Credits.txt'
--- Credits.txt	2010-04-18 04:11:04 +0000
+++ Credits.txt	2010-10-14 03:51:12 +0000
@@ -46,6 +46,7 @@
 mark
 Jakh Daven
 Andrew Browne
+DjSlash
 
 DC++:
 -----

=== modified file 'SConstruct'
--- SConstruct	2010-10-11 23:45:49 +0000
+++ SConstruct	2010-10-14 06:00:38 +0000
@@ -17,23 +17,30 @@
 BUILD_PATH = '#/build/'
 BUILD_LOCALE_PATH = BUILD_PATH + 'locale/'
 
+# todo: remove -fpermissive and fix the errors
+BUILD_FLAGS = {
+	'common': ['-I#', '-fpermissive', '-D_GNU_SOURCE', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_REENTRANT'],
+	'debug': ['-g', '-ggdb', '-Wall'], 
+	'release' : ['-O3', '-fomit-frame-pointer', '-DNDEBUG']
+}
+
 # ----------------------------------------------------------------------
 # Function definitions
 # ----------------------------------------------------------------------
 
-def CheckPKGConfig(context):
+def check_pkg_config(context):
 	context.Message('Checking for pkg-config... ')
 	ret = context.TryAction('pkg-config --version')[0]
 	context.Result(ret)
 	return ret
 
-def CheckPKG(context, name):
+def check_pkg(context, name):
 	context.Message('Checking for %s... ' % name)
 	ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
 	context.Result(ret)
 	return ret
 
-def CheckCXXVersion(context, name, major, minor):
+def check_cxx_version(context, name, major, minor):
 	context.Message('Checking for %s >= %d.%d...' % (name, major, minor))
 	ret = commands.getoutput('%s -dumpversion' % name)
 
@@ -48,21 +55,22 @@
 	context.Result(retval)
 	return retval
 
-def CheckBZRRevision():
-	print "Checking tree revision...",
-	retval = ''
+def check_bzr_revision(context):
+	context.Message("Checking bzr revision...")
+	revision = ''
 
 	try:
 		b = branch.Branch.open('.')
-		retval = b.revno()
-		print retval
+		revision = str(b.revno())
 	except:
 		print "failed"
 
-	return retval
+	context.env['BZR_REVISION'] = revision
+	context.Result(revision)
+	return revision
 
 # Install app icons to share/icons and all others to share/linuxdcpp/icons
-def install_icons(icons_dir, env):
+def install_icons(env, icons_dir):
 	prefix = env['FAKE_ROOT'] + os.path.join(env['PREFIX'], 'share')
 
 	for root, dirs, files in os.walk(icons_dir):
@@ -115,30 +123,28 @@
 
 env = Environment(ENV = os.environ, variables = vars, package = PACKAGE)
 
-conf = Configure(env,
-	custom_tests =
-	{
-		'CheckPKGConfig' : CheckPKGConfig,
-		'CheckPKG' : CheckPKG,
-		'CheckCXXVersion' : CheckCXXVersion
-	},
-	conf_dir = 'build/sconf',
-	log_file = 'build/sconf/config.log')
+env['mode'] = 'debug' if env.get('debug') else 'release'
+env['build_path'] = BUILD_PATH + env['mode'] + '/'
 
 if os.environ.has_key('CXX'):
-	conf.env['CXX'] = os.environ['CXX']
+	env['CXX'] = os.environ['CXX']
+else:
+	print 'CXX env variable is not set, attempting to use g++'
+	env['CXX'] = 'g++'
 
 if os.environ.has_key('CC'):
-	conf.env['CC'] = os.environ['CC']
+	env['CC'] = os.environ['CC']
 
 if os.environ.has_key('CXXFLAGS'):
-	conf.env['CPPFLAGS'] = conf.env['CXXFLAGS'] = os.environ['CXXFLAGS'].split()
+	env['CPPFLAGS'] = env['CXXFLAGS'] = os.environ['CXXFLAGS'].split()
 
 if os.environ.has_key('LDFLAGS'):
-	conf.env['LINKFLAGS'] = os.environ['LDFLAGS'].split()
+	env['LINKFLAGS'] = os.environ['LDFLAGS'].split()
 
 if os.environ.has_key('CFLAGS'):
-	conf.env['CFLAGS'] = os.environ['CFLAGS'].split()
+	env['CFLAGS'] = os.environ['CFLAGS'].split()
+
+env['CPPDEFINES'] = [] # Initialize as a list so Append doesn't concat strings
 
 env.SConsignFile('build/sconf/.sconsign')
 vars.Save('build/sconf/scache.conf', env)
@@ -162,6 +168,18 @@
 env.Append(BUILDERS = {'MoBuild' : mo_build})
 
 env.AddMethod(generate_message_catalogs, 'GenerateMessageCatalogs')
+env.AddMethod(install_icons, 'InstallIcons')
+
+conf = env.Configure(
+	custom_tests =
+	{
+		'CheckPKGConfig' : check_pkg_config,
+		'CheckPKG' : check_pkg,
+		'CheckCXXVersion' : check_cxx_version,
+		'CheckBZRRevision' : check_bzr_revision
+	},
+	conf_dir = 'build/sconf',
+	log_file = 'build/sconf/config.log')
 
 
 # ----------------------------------------------------------------------
@@ -170,10 +188,6 @@
 
 if not 'install' in COMMAND_LINE_TARGETS:
 
-	if not conf.env.get('CXX'):
-		print 'CXX env variable is not set, attempting to use g++'
-		conf.env['CXX'] = 'g++'
-
 	if not conf.CheckCXXVersion(env['CXX'], 4, 1):
 		print 'Compiler version check failed. g++ 4.1 or later is needed'
 		Exit(1)
@@ -197,12 +211,13 @@
 		print '\tNote: You might have the lib but not the headers'
 		Exit(1)
 
+	# TODO: Implement a plugin system so libnotify doesn't have compile-time dependencies
 	if not conf.CheckPKG('libnotify >= 0.4.1'):
 		print '\tlibnotify >= 0.4.1 not found, disabling notifications.'
 		print '\tNote: You might have the lib but not the headers'
-		conf.env['HAVE_LIBNOTIFY'] = False
 	else:
-		conf.env['HAVE_LIBNOTIFY'] = True
+		conf.env.Append(CPPDEFINES = 'HAVE_LIBNOTIFY')
+		conf.env.ParseConfig('pkg-config --libs libnotify')
 	
 	if not conf.CheckCXXHeader('boost/version.hpp', '<>'):
 		print '\tboost not found.'
@@ -252,10 +267,12 @@
 	if not conf.CheckHeader('iconv.h'):
 		Exit(1)
 	elif conf.CheckLibWithHeader('iconv', 'iconv.h', 'c', 'iconv(0, (const char **)0, 0, (char**)0, 0);'):
-		conf.env['ICONV_CONST'] = 'const'
+		conf.env.Append(CPPDEFINES = ('ICONV_CONST', 'const'))
 
 	if conf.CheckHeader(['sys/types.h', 'sys/socket.h', 'ifaddrs.h', 'net/if.h']):
-		conf.env['HAVE_IFADDRS_H'] = True
+		conf.env.Append(CPPDEFINES = 'HAVE_IFADDRS_H')
+
+	conf.CheckBZRRevision()
 
 	env = conf.Finish()
 
@@ -264,44 +281,24 @@
 # Compile and link flags
 # ----------------------------------------------------------------------
 
-	env['LDCPP_BZRREV'] = CheckBZRRevision()
+	env.MergeFlags(BUILD_FLAGS['common'])
+	env.MergeFlags(BUILD_FLAGS[env['mode']])
+	env.ParseConfig('pkg-config --libs libglade-2.0')
+	env.ParseConfig('pkg-config --libs gthread-2.0')
 
-	# todo: remove -fpermissive and fix the errors
-	env.Append(CXXFLAGS = ['-I.', '-fpermissive'])
-	env.Append(CPPDEFINES = ['_GNU_SOURCE', '_LARGEFILE_SOURCE', ('_FILE_OFFSET_BITS', '64'), '_REENTRANT'])
+	env.Append(LIBPATH = env['build_path'] + CORE_PACKAGE)
+	env.Prepend(LIBS = 'dcpp')
 
 	if os.sys.platform == 'linux2':
 		env.Append(LINKFLAGS = '-Wl,--as-needed')
 
 	if os.name == 'mac' or os.sys.platform == 'darwin':
-		env['ICONV_CONST'] = ''
+		conf.env.Append(CPPDEFINES = ('ICONV_CONST', ''))
 
 	if os.sys.platform == 'sunos5':
-		env['ICONV_CONST'] = 'const'
+		conf.env.Append(CPPDEFINES = ('ICONV_CONST', 'const'))
 		env.Append(LIBS = ['socket', 'nsl'])
 
-	if env.get('ICONV_CONST'):
-		env.Append(CPPDEFINES = ('ICONV_CONST', env['ICONV_CONST']))
-
-	if env.get('HAVE_IFADDRS_H'):
-		env.Append(CPPDEFINES = 'HAVE_IFADDRS_H')
-
-	# TODO: Implement a plugin system so libnotify doesn't have compile-time dependencies
-	if env.get('HAVE_LIBNOTIFY'):
-		env.Append(CPPDEFINES = 'HAVE_LIBNOTIFY')
-		env.ParseConfig('pkg-config --libs libnotify')
-
-	if env.get('debug'):
-		env.Append(CPPDEFINES = '_DEBUG')
-		env.Append(CXXFLAGS = ['-g', '-ggdb', '-Wall'])
-		env.Append(LINKFLAGS = ['-g', '-ggdb', '-Wall'])
-		BUILD_PATH = BUILD_PATH + 'debug/'
-
-	elif env.get('release'):
-		env.Append(CPPDEFINES = '_NDEBUG')
-		env.Append(CXXFLAGS = ['-O3', '-fomit-frame-pointer'])
-		BUILD_PATH = BUILD_PATH + 'release/'
-
 	if env.get('profile'):
 		env.Append(CXXFLAGS = '-pg')
 		env.Append(LINKFLAGS= '-pg')
@@ -310,11 +307,6 @@
 		data_dir = '\'\"%s/share\"\'' % env['PREFIX']
 		env.Append(CPPDEFINES = ('_DATADIR', data_dir))
 
-	env.ParseConfig('pkg-config --libs libglade-2.0')
-	env.ParseConfig('pkg-config --libs gthread-2.0')
-
-	env.Append(LIBPATH = BUILD_PATH + CORE_PACKAGE)
-	env.Prepend(LIBS = 'dcpp')
 
 # ----------------------------------------------------------------------
 # Build
@@ -322,13 +314,13 @@
 
 	# Build the dcpp library
 	dcpp_env = env.Clone(package = CORE_PACKAGE)
-	libdcpp = SConscript(dirs = 'dcpp', variant_dir = BUILD_PATH + CORE_PACKAGE, duplicate = 0, exports = {'env': dcpp_env})
+	libdcpp = SConscript(dirs = 'dcpp', variant_dir = env['build_path'] + CORE_PACKAGE, duplicate = 0, exports = {'env': dcpp_env})
 
 	# Build the GUI
 	ui_env = env.Clone()
-	glade_pot_file = SConscript(dirs = 'glade', variant_dir = BUILD_PATH + 'glade', duplicate = 0, exports = {'env': ui_env})
+	glade_pot_file = SConscript(dirs = 'glade', variant_dir = env['build_path'] + 'glade', duplicate = 0, exports = {'env': ui_env})
 
-	(linux_pot_file, obj_files) = SConscript(dirs = 'linux', variant_dir = BUILD_PATH + 'gui', duplicate = 0, exports = {'env': ui_env})
+	(linux_pot_file, obj_files) = SConscript(dirs = 'linux', variant_dir = env['build_path'] + 'gui', duplicate = 0, exports = {'env': ui_env})
 
 	# Create the executable
 	env.Program(target = PACKAGE, source = [libdcpp, obj_files])
@@ -349,7 +341,7 @@
 	prefix = env['FAKE_ROOT'] + env['PREFIX']
 	desktop_file = os.path.join('data', PACKAGE + '.desktop')
 
-	install_icons('icons/hicolor/', env)
+	env.InstallIcons('icons/hicolor/')
 	env.Alias('install', env.Install(dir = os.path.join(prefix, 'share', 'locale'), source = BUILD_LOCALE_PATH))
 	env.Alias('install', env.Install(dir = os.path.join(prefix, 'share', PACKAGE, 'glade'), source = glade_files))
 	env.Alias('install', env.Install(dir = os.path.join(prefix, 'share', 'doc', PACKAGE), source = text_files))

=== modified file 'debian/changelog'
--- debian/changelog	2009-10-22 03:11:11 +0000
+++ debian/changelog	2010-10-12 04:50:18 +0000
@@ -1,4 +1,4 @@
-linuxdcpp (1.1.0-1) unstable; urgency=low
+linuxdcpp (1.1.0~pre1-1) unstable; urgency=low
 
   * Initial creation of debian package
 

=== modified file 'glade/mainwindow.glade'
--- glade/mainwindow.glade	2010-07-27 04:26:37 +0000
+++ glade/mainwindow.glade	2010-10-14 03:51:12 +0000
@@ -899,6 +899,7 @@
   mark
   Jakh Daven
   Andrew Browne
+  DjSlash
 </property>
     <property name="artists">Johannes Sjölund</property>
     <property name="wrap_license">True</property>

=== modified file 'linux/SConscript'
--- linux/SConscript	2010-10-11 23:45:49 +0000
+++ linux/SConscript	2010-10-14 06:00:38 +0000
@@ -2,21 +2,20 @@
 
 Import('env')
 
+VERSION_SOURCE = 'version.cc'
+
+header_files = env.Glob('*.hh')
 gui_files = env.Glob('*.cc')
-header_files = env.Glob('*.hh')
+gui_files.remove(File(VERSION_SOURCE))
 obj_files = []
 
 env.ParseConfig('pkg-config --cflags libglade-2.0')
 env.Append(CPPDEFINES='PACKAGE=\'\"%s\"\'' % env['package'])
 
 # Build the gui_files
-for i, source in enumerate(gui_files):
-	#define LDCPP_BZRREV for linux/version.cc
-	if str(source).find("version.cc") != -1:
-		ldcpp_bzrrev = 'LDCPP_BZRREV=\\"%s\\"' % env['LDCPP_BZRREV']
-		obj_files.append(env.Object(source, CPPDEFINES = ldcpp_bzrrev)) 
-	else:
-		obj_files.append(env.Object(source))
+obj_files = env.Object(gui_files)
+obj_file = env.Object(VERSION_SOURCE, CPPDEFINES = 'BZR_REVISION=\\"%s\\"' % env['BZR_REVISION'])
+obj_files.append(obj_file)
 
 pot_file = env.PotBuild(source=gui_files + header_files, target='po/linux.pot', LANGUAGE='C++')
 

=== modified file 'linux/UserCommandMenu.cc'
--- linux/UserCommandMenu.cc	2009-04-02 02:40:10 +0000
+++ linux/UserCommandMenu.cc	2010-10-14 03:51:12 +0000
@@ -53,12 +53,13 @@
 	ucParams.push_back(u);
 }
 
-void UserCommandMenu::addFile(const std::string &cid, const std::string &name,
+void UserCommandMenu::addFile(const std::string &cid, const std::string &name, const std::string &path,
 	const int64_t &size, const std::string &tth)
 {
 	UCParam u;
 	u.cid = cid;
 	u.name = name;
+	u.path = path;
 	u.size = size;
 	u.tth = tth;
 	if (u.tth.empty())
@@ -168,10 +169,11 @@
 			if (!i->name.empty() && !i->type.empty())
 			{
 				params["type"] = i->type;
-	 			params["fileFN"] = i->name;
+	 			params["fileFN"] = i->path + i->name;
 	 			params["fileSI"] = Util::toString(i->size);
 	 			params["fileSIshort"] = Util::formatBytes(i->size);
 	 			params["fileTR"] = i->tth;
+				params["fileMN"] = WulforUtil::makeMagnet(i->name, i->size, i->tth);
 	 			params["file"] = params["fileFN"];
 	 			params["filesize"] = params["fileSI"];
 	 			params["filesizeshort"] = params["fileSIshort"];

=== modified file 'linux/UserCommandMenu.hh'
--- linux/UserCommandMenu.hh	2009-04-02 02:40:10 +0000
+++ linux/UserCommandMenu.hh	2010-10-14 03:51:12 +0000
@@ -37,8 +37,8 @@
 		void addHub(const std::string &hub);
 		void addHub(const dcpp::StringList &hubs2);
 		void addUser(const std::string &cid);
-		void addFile(const std::string &cid, const std::string &name,
-			const int64_t &size, const std::string &tth);
+		void addFile(const std::string &cid, const std::string &name, const std::string &path,
+			const int64_t &size = 0, const std::string &tth = "");
 		void cleanMenu_gui();
 		void buildMenu_gui();
 
@@ -59,6 +59,7 @@
 		{
  			std::string cid;
  			std::string name;
+			std::string path;
  			int64_t size;
  			std::string tth;
  			std::string type;

=== modified file 'linux/search.cc'
--- linux/search.cc	2010-10-11 06:05:22 +0000
+++ linux/search.cc	2010-10-14 06:00:38 +0000
@@ -311,6 +311,7 @@
 			userCommandMenu->addHub(resultView.getString(&iter, "Hub URL"));
 			userCommandMenu->addFile(resultView.getString(&iter, "CID"),
 				resultView.getString(&iter, "Filename"),
+				resultView.getString(&iter, "Path"),
 				resultView.getValue<int64_t>(&iter, "Real Size"),
 				resultView.getString(&iter, "TTH"));
 

=== modified file 'linux/sharebrowser.cc'
--- linux/sharebrowser.cc	2009-08-15 04:40:26 +0000
+++ linux/sharebrowser.cc	2010-10-14 03:51:12 +0000
@@ -480,8 +480,24 @@
 		GtkTreePath *path = (GtkTreePath *)i->data;
 		if (gtk_tree_model_get_iter(GTK_TREE_MODEL(fileStore), &iter, path))
 		{
+			string filepath;
+			string fileOrder = fileView.getString(&iter, "File Order");
+			gpointer ptr = fileView.getValue<gpointer>(&iter, "DL File");
+
+			if (fileOrder[0] == 'd')
+			{
+				DirectoryListing::Directory *dir = (DirectoryListing::Directory *)ptr;
+				filepath = listing.getPath(dir->getParent());
+			}
+			else
+			{
+				DirectoryListing::File *file = (DirectoryListing::File *)ptr;
+				filepath = listing.getPath(file);
+			}
+
 			fileUserCommandMenu->addFile(cid,
 				fileView.getString(&iter, "Filename"),
+				filepath,
 				fileView.getValue<int64_t>(&iter, "Size Order"),
 				fileView.getString(&iter, "TTH"));
 		}
@@ -521,23 +537,25 @@
 	gtk_menu_shell_append(GTK_MENU_SHELL(getWidget("dirDownloadMenu")), menuItem);
 
 	// Add user commands.
-	StringList hubs = WulforUtil::getHubAddress(listing.getUser()->getCID());
-	dirUserCommandMenu->addHub(hubs);
 	GtkTreeIter iter;
-	GList *list = gtk_tree_selection_get_selected_rows(dirSelection, NULL);
-	string cid = listing.getUser()->getCID().toBase32();
-
-	for (GList *i = list; i; i = i->next)
+	if (gtk_tree_selection_get_selected(dirSelection, NULL, &iter))
 	{
-		GtkTreePath *path = (GtkTreePath *)i->data;
-		if (gtk_tree_model_get_iter(GTK_TREE_MODEL(dirStore), &iter, path))
+		string filename;
+		string filepath;
+		string cid = listing.getUser()->getCID().toBase32();
+		StringList hubs = WulforUtil::getHubAddress(listing.getUser()->getCID());
+		DirectoryListing::Directory *dir = dirView.getValue<DirectoryListing::Directory *>(&iter, "DL Dir");
+
+		if (dir != listing.getRoot())
 		{
-			dirUserCommandMenu->addFile(cid, dirView.getString(&iter, "Dir"), 0, "");
+			filename = dirView.getString(&iter, "Dir");
+			filepath = listing.getPath(dir->getParent());
 		}
-		gtk_tree_path_free(path);
+
+		dirUserCommandMenu->addFile(cid, filename, filepath);
+		dirUserCommandMenu->addHub(hubs);
+		dirUserCommandMenu->buildMenu_gui();
 	}
-	g_list_free(list);
-	dirUserCommandMenu->buildMenu_gui();
 
 	gtk_menu_popup(GTK_MENU(getWidget("dirMenu")), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
 	gtk_widget_show_all(getWidget("dirMenu"));

=== modified file 'linux/version.cc'
--- linux/version.cc	2010-03-24 06:29:10 +0000
+++ linux/version.cc	2010-10-12 04:50:18 +0000
@@ -21,5 +21,5 @@
 
 #include "version.hh"
 
-const char* LINUXDCPP_VERSION_STRING = "1.0.3-bzr" LDCPP_BZRREV;
+const char* LINUXDCPP_VERSION_STRING = "1.1.0~pre1~bzr" BZR_REVISION;