Changeset 252

Show
Ignore:
Timestamp:
06/04/08 21:39:02 (4 years ago)
Author:
ath
Message:

Pick up latest commits from the "fixes" branch.

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/fm_gui/src/global.c

    r251 r252  
    1 #include <string.h> 
    21#include <glib.h> 
    32#ifdef G_OS_WIN32 
     
    1413#include "binreloc.h" 
    1514 
    16 #define LIBDIR_SUFFIX ".libs" 
    17  
    1815 
    1916static gchar *prefix; 
     17static gchar *exe_path; 
    2018static gchar *bin_path; 
    2119//static gchar *lib_path; 
     
    2725{ 
    2826        GError *err = NULL; 
    29         gchar *prefix_temp; 
    3027 
    3128#ifdef G_OS_WIN32 
    32         TCHAR exe_filename[MAX_PATH]; 
     29        TCHAR path[MAX_PATH]; 
    3330         
    34         GetModuleFileName (NULL, exe_filename, MAX_PATH); 
     31        GetModuleFileName (NULL, path, MAX_PATH); 
    3532         
    3633        exe_path = g_path_get_dirname (path); 
    37         g_print ("Executable is %s\n", exe_filename); 
    38         prefix_temp = g_strdup (prefix_temp); 
    3934#else 
    40  
    41         gboolean in_source_dir; 
    42  
    4335        if (gbr_init (&err)) 
    4436                g_print("binreloc available!\n"); 
     
    4941        if (!exe_filename) 
    5042                g_warning ("Can't determine installation prefix!"); 
    51         else 
    52                 g_print ("Executable is %s\n", exe_filename); 
    5343 
    54         prefix_temp = g_path_get_dirname (exe_filename); 
    55         g_print ("prefix_temp %s\n", prefix_temp); 
    56         gchar *basename = g_path_get_basename (prefix_temp); 
    57         g_print ("basename %s\n", basename); 
     44        exe_path = g_path_get_dirname (exe_filename);    
     45        g_free (exe_filename); 
     46#endif 
    5847 
    59         if (strcmp (basename, LIBDIR_SUFFIX) == 0) { 
    60                 g_print ("we are in a libtool temporary directory, adjusting path...\n"); 
     48        gchar *makefile_name = g_build_filename (exe_path, "Makefile.am", NULL); 
     49        gchar *data_path_temp = NULL; 
     50        if (g_file_test (makefile_name, G_FILE_TEST_EXISTS)) { 
     51                g_print ("%s exists, we are in the source directory\n", makefile_name); 
    6152 
    62                 prefix_temp = g_strdup (prefix_temp); 
    63                 prefix_temp[strlen (prefix_temp) - strlen (LIBDIR_SUFFIX) - 1] = '\0'; 
     53                prefix = g_path_get_dirname (exe_path); 
     54                bin_path = g_strdup (exe_path); 
     55                data_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "data", NULL); 
     56        } else { 
     57                prefix = gbr_find_prefix (PREFIX); 
     58 
     59#ifdef G_OS_WIN32        
     60                bin_path = g_build_path (G_DIR_SEPARATOR_S, path, "bin", NULL); 
     61//              lib_path = g_build_path (G_DIR_SEPARATOR_S, path, "lib", NULL); 
     62                data_path_temp = g_build_path (G_DIR_SEPARATOR_S, path, "share", NULL); 
     63#else 
     64                bin_path = gbr_find_lib_dir (PREFIX "/bin"); 
     65//              lib_path = gbr_find_lib_dir (PREFIX "/lib"); 
     66                data_path_temp = gbr_find_data_dir (PREFIX "/share/fm_gui"); 
     67#endif 
     68                data_path = g_build_path (G_DIR_SEPARATOR_S, data_path_temp, "fm_gui", NULL); 
    6469        } 
    6570 
    66         g_free (basename); 
    6771 
    68         basename = g_path_get_basename (prefix_temp); 
    69  
    70         if (strcmp (basename, "src") == 0) 
    71                 in_source_dir = TRUE; 
    72         else 
    73                 in_source_dir = FALSE; 
    74  
    75         prefix_temp[strlen (prefix_temp) - strlen (basename)] = '\0'; 
    76  
    77         g_free (basename); 
    78  
    79  
    80 #endif 
    81  
    82         g_print ("base path %s --- ", prefix_temp); 
    83         if (in_source_dir) { 
    84                 g_print ("source directory\n"); 
    85  
    86                 prefix = g_strdup (prefix_temp); 
    87                 bin_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "src", NULL); 
    88                 data_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "data", NULL); 
    89  
    90         } else { 
    91                 g_print ("installation directory\n"); 
    92  
    93                 prefix = g_strdup (prefix_temp); 
    94                 bin_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "bin", NULL); 
    95                 data_path = g_build_path (G_DIR_SEPARATOR_S, prefix, "share", PACKAGE, NULL); 
    96  
    97         } 
    9872         
    99         g_free (prefix_temp); 
     73        g_free (makefile_name); 
    10074 
    10175        g_print ("prefix %s\n", prefix); 
    102         g_print ("bin_path %s\n", bin_path); 
     76        g_print ("exe_path %s\n", exe_path); 
    10377        g_print ("data_path %s\n", data_path); 
    10478} 
  • trunk/fm_server/src/fm_output.c

    r250 r252  
    108108fm_output_start                         (FmOutput       *output) 
    109109{ 
    110         FmOutputClass *klass = FM_OUTPUT_GET_CLASS (output); 
    111         FmElement *element = FM_ELEMENT (output); 
    112  
    113         if (!element->active) { 
    114                 g_warning ("element \"%s\" is not active, cancel start!", 
    115                          fm_element_get_name (FM_ELEMENT (output))); 
    116                 return FALSE; 
    117         } 
    118  
    119         if (klass->start) 
    120                 return (*klass->start) (output); 
     110        FmOutputClass *class = FM_OUTPUT_GET_CLASS(output); 
     111         
     112        if (class->start) 
     113                return (*class->start)(output); 
    121114        else { 
    122115                g_warning ("\"start\" method not defined for element \"%s\"!", 
    123                          fm_element_get_name (FM_ELEMENT (output))); 
     116                         fm_element_get_name(FM_ELEMENT(output))); 
    124117                return FALSE; 
    125118        } 
     
    130123fm_output_stop                          (FmOutput       *output) 
    131124{ 
    132         FmOutputClass *klass = FM_OUTPUT_GET_CLASS (output); 
    133         FmElement *element = FM_ELEMENT (output); 
    134  
    135         if (!element->active) { 
    136                 g_warning ("element \"%s\" is not active, cancel start!", 
    137                          fm_element_get_name (FM_ELEMENT (output))); 
    138                 return FALSE;            
    139         } 
     125        FmOutputClass *class = FM_OUTPUT_GET_CLASS(output); 
    140126         
    141         if (klass->stop) 
    142                 return (*klass->stop) (output); 
     127        if (class->stop) 
     128                return (*class->stop)(output); 
    143129        else { 
    144130                g_warning ("\"stop\" method not defined for element \"%s\"!", 
    145                          fm_element_get_name (FM_ELEMENT (output))); 
     131                         fm_element_get_name(FM_ELEMENT(output))); 
    146132                return FALSE; 
    147133        }