Skip to content

Commit

Permalink
Merge pull request #19 from rburchell/master
Browse files Browse the repository at this point in the history
Remove session file reading.
  • Loading branch information
rburchell committed Oct 11, 2013
2 parents 634bddc + ff9e548 commit 8290f99
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 469 deletions.
2 changes: 1 addition & 1 deletion src/plugins/profile/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugindir = @NGFD_PLUGIN_DIR@
plugin_LTLIBRARIES = libngfd_profile.la
libngfd_profile_la_SOURCES = plugin.c session.c
libngfd_profile_la_SOURCES = plugin.c
libngfd_profile_la_LIBADD = @NGFD_PLUGIN_LIBS@ @DBUS_LIBS@ @PROFILE_LIBS@
libngfd_profile_la_LDFLAGS = -module -avoid-version
libngfd_profile_la_CFLAGS = @NGFD_PLUGIN_CFLAGS@ @DBUS_CFLAGS@ @PROFILE_CFLAGS@ -I$(top_srcdir)/src/include
Expand Down
45 changes: 29 additions & 16 deletions src/plugins/profile/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "profile-plugin.h"
#include "session.h"

#include <profiled/libprofile.h>
#include <stdlib.h>

#include <sys/types.h>
#include <dirent.h>

#include <dbus/dbus.h>

#include <ngf/core.h>
#include <ngf/plugin.h>
#include <ngf/event.h>
#include <ngf/context.h>
Expand Down Expand Up @@ -57,6 +57,7 @@ typedef struct _ProfileEntry
gchar *target;
} ProfileEntry;

static DBusConnection *session_bus = NULL;
static guint num_system_sound_levels = 0;
static int *system_sound_levels = NULL;
static GList *request_keys = NULL;
Expand Down Expand Up @@ -281,15 +282,6 @@ find_profile_entries (NCore *core)
}
}

void
profile_plugin_reconnect (NCore *core, DBusConnection *session_bus)
{
profile_connection_set (session_bus);

query_current_profile (core);
query_current_values (core);
}

static gchar*
find_file_from_path (const char *start_path, const char *filename,
int current_depth)
Expand Down Expand Up @@ -520,6 +512,30 @@ setup_system_sound_levels (NValue *value)
g_strfreev (split);
}

static gboolean
setup_session_bus_connection (NCore *core)
{
/* setup the session bus connection */
DBusError error;
dbus_error_init(&error);

if (!session_bus) {
session_bus = dbus_bus_get(DBUS_BUS_SESSION, &error);
if (dbus_error_is_set(&error)) {
N_DEBUG (LOG_CAT "Could not connect to DBus session bus.");
return FALSE;
}
}

N_DEBUG (LOG_CAT "Connected to DBus session bus.");
profile_connection_set (session_bus);

query_current_profile (core);
query_current_values (core);

return TRUE;
}

N_PLUGIN_LOAD (plugin)
{
NCore *core = NULL;
Expand Down Expand Up @@ -558,17 +574,14 @@ N_PLUGIN_LOAD (plugin)

profile_tracker_init ();

/* setup the session */

if (!session_initialize (core))
if (!setup_session_bus_connection (core))
return FALSE;

return TRUE;
}

N_PLUGIN_UNLOAD (plugin)
{
session_shutdown ();
profile_tracker_quit ();

g_free (file_search_path);
Expand Down
30 changes: 0 additions & 30 deletions src/plugins/profile/profile-plugin.h

This file was deleted.

Loading

0 comments on commit 8290f99

Please sign in to comment.