Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
- merge with master and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ingorichter committed Oct 28, 2014
2 parents f9d3201 + 3baf16c commit 568873e
Show file tree
Hide file tree
Showing 24 changed files with 854 additions and 228 deletions.
42 changes: 42 additions & 0 deletions CEF-Info.plist
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>11G56</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>libcef</string>
<key>CFBundleGetInfoString</key>
<string>CEF 1547</string>
<key>CFBundleIdentifier</key>
<string>com.cef</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>cef</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1547</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1547</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>4G2008a</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>11E52</string>
<key>DTSDKName</key>
<string>macosx10.7</string>
<key>DTXcode</key>
<string>0452</string>
<key>DTXcodeBuild</key>
<string>4G2008a</string>
</dict>
</plist>
14 changes: 11 additions & 3 deletions Gruntfile.js
Expand Up @@ -118,8 +118,6 @@ module.exports = function (grunt) {
}
]
},
// FIXME: see stage-mac task issues with copying .app bundles
/*
"mac": {
"files": [
{
Expand All @@ -128,9 +126,19 @@ module.exports = function (grunt) {
"src" : ["**"],
"dest" : "installer/mac/staging/<%= build.name %>.app/"
}
],
options: {
mode: true
}
},
"cefplist" : {
"files": [
{
"src" : "CEF-Info.plist",
"dest" : "installer/mac/staging/<%= build.name %>.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/Info.plist"
}
]
},
*/
"linux": {
"files": [
{
Expand Down
8 changes: 4 additions & 4 deletions appshell.gyp
Expand Up @@ -239,7 +239,7 @@
}
],
'cflags': [
'<!@(<(pkg-config) --cflags gtk+-2.0 gthread-2.0)',
'<!@(<(pkg-config) --cflags gtk+-2.0 gthread-2.0 glib-2.0)',
'<(march)',
],
'include_dirs': [
Expand Down Expand Up @@ -283,12 +283,12 @@
],
'link_settings': {
'ldflags': [
'<!@(<(pkg-config) --libs-only-other gtk+-2.0 gthread-2.0)',
'<!@(<(pkg-config) --libs-only-other gtk+-2.0 gthread-2.0 glib-2.0)',
'-Wl,-rpath,\$$ORIGIN/lib',
'<(march)'
],
'libraries': [
'<!@(<(pkg-config) --libs-only-l gtk+-2.0 gthread-2.0)',
'<!@(<(pkg-config) --libs-only-l gtk+-2.0 gthread-2.0 glib-2.0)',
'$(BUILDTYPE)/libcef.so',
'appshell_extensions_js.o',
],
Expand Down Expand Up @@ -328,7 +328,7 @@
'conditions': [
['OS=="linux"', {
'cflags': [
'<!@(<(pkg-config) --cflags gtk+-2.0 gthread-2.0)',
'<!@(<(pkg-config) --cflags gtk+-2.0 gthread-2.0 glib-2.0)',
'<(march)',
],
'default_configuration': 'Release',
Expand Down
96 changes: 88 additions & 8 deletions appshell/appshell_extensions_gtk.cpp
Expand Up @@ -24,6 +24,7 @@
#include "client_app.h"
#include <glib.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include "appshell_extensions.h"
#include "appshell_extensions_platform.h"
Expand Down Expand Up @@ -546,19 +547,98 @@ void BringBrowserWindowToFront(CefRefPtr<CefBrowser> browser)
}
}

gboolean FileManager1_ShowItems(const gchar *path) {
static gboolean FileManager1_exists = TRUE;
GDBusProxy *proxy = NULL;
GDBusProxyFlags flags = G_DBUS_PROXY_FLAGS_NONE;
gchar *uri = NULL;
GVariant *call_result = NULL;
GError *error = NULL;

if (!FileManager1_exists) {
return FALSE;
}

proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
flags,
NULL,
"org.freedesktop.FileManager1", // name
"/org/freedesktop/FileManager1", // path
"org.freedesktop.FileManager1", // iface
NULL,
&error);

if (proxy == NULL) {
g_printerr("Error creating proxy: %s\n", error->message);
g_error_free(error);
return FALSE;
}

uri = g_filename_to_uri(path, NULL, NULL);
if (uri == NULL) {
return FALSE;
}

// The "ShowItems" method requires two parameters
// 1. An array of URI strings, the files to show
// 2. The DESKTOP_STARTUP_ID environment variable, used to prevent focus stealing
// (Reference: http://www.freedesktop.org/wiki/Specifications/file-manager-interface/)
const gchar *uris[2] = { uri, NULL };
const gchar *startup_id = "dontstealmyfocus";

call_result = g_dbus_proxy_call_sync(proxy,
"ShowItems", // method
g_variant_new("(^ass)", uris, startup_id), // parameters
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);

g_object_unref(proxy);
g_free(uri);

if (call_result != NULL) {
g_variant_unref(call_result);
}
else {
g_printerr("Error calling the 'ShowItems' method: %s\n", error->message);
g_error_free(error);
FileManager1_exists = FALSE;
return FALSE;
}

return TRUE;
}

int ShowFolderInOSWindow(ExtensionString pathname)
{
int error = NO_ERROR;
GError *gerror = NULL;
gchar *uri = g_strdup_printf("file://%s", pathname.c_str());

if (!gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, &gerror)) {
error = ConvertGnomeErrorCode(gerror);
g_warning("%s", gerror->message);
g_error_free(gerror);
gchar *uri = NULL, *parentdir = NULL;

if (g_file_test(pathname.c_str(), G_FILE_TEST_IS_DIR)) {
uri = g_filename_to_uri(pathname.c_str(), NULL, NULL);
if (!gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, &gerror)) {
error = ConvertGnomeErrorCode(gerror);
g_warning("%s", gerror->message);
g_error_free(gerror);
}
g_free(uri);
}
else {
if (!FileManager1_ShowItems(pathname.c_str())) {
// Fall back to using gtk_show_uri on the dirname (without highlighting the file)
parentdir = g_path_get_dirname(pathname.c_str());
uri = g_filename_to_uri(parentdir, NULL, NULL);
if (!gtk_show_uri(NULL, uri, GDK_CURRENT_TIME, &gerror)) {
error = ConvertGnomeErrorCode(gerror);
g_warning("%s", gerror->message);
g_error_free(gerror);
}
g_free(parentdir);
g_free(uri);
}
}

g_free(uri);

return error;
}
Expand Down

0 comments on commit 568873e

Please sign in to comment.