~bregma/ginn/packaging-699925

« back to all changes in this revision

Viewing changes to src/bamf.c

  • Committer: Mohamed-ikbel Boulabiar
  • Date: 2010-12-10 17:03:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: boulabiar@gmail.com-20101210170352-0nxar99xvq8oc9e4
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2010 Canonical Ltd.
3
 
 *
4
 
 * This library is free software; you can redistribute it and/or modify it under
5
 
 * the terms of the GNU General Public License as published by the Free Software
6
 
 * Foundation; either version 3 of the License, or (at your option) any later
7
 
 * version.
8
 
 *
9
 
 * This library is distributed in the hope that it will be useful, but WITHOUT
10
 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
 
 * details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License along with
15
 
 * this program; if not, write to the Free Software Foundation, Inc., 51
16
 
 * Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
17
 
 */
18
 
 
19
 
#include <libbamf/bamf-matcher.h>
20
 
#include <string.h>
21
 
 
22
 
char *
23
 
getName(char * deskfile)
24
 
{
25
 
  char *temp;
26
 
  if (!deskfile)
27
 
    return '\0';
28
 
  temp = strrchr(deskfile, '/');
29
 
  return strndup(temp+1, strlen(temp)-9);
30
 
}
31
 
 
32
 
char *
33
 
getCurrentApp()
34
 
{
35
 
  g_type_init();
36
 
  char *deskfile;
37
 
  BamfWindow * win = NULL;
38
 
 
39
 
  BamfApplication * app = bamf_matcher_get_active_application(bamf_matcher_get_default());
40
 
  deskfile = getName((char*)bamf_application_get_desktop_file(app));
41
 
 
42
 
  return deskfile;
43
 
}
44